aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-09-20 21:53:58 -0500
committerJP Dillingham <jpdillingham@gmail.com>2021-09-20 21:53:58 -0500
commitf0231b87dc5d06933876be2f57fa0b27753c355b (patch)
treef568ca55d4e3d259386c8c8ed60a8e81b81c5198 /src
parentf7e774d83cea066c079fbcd1d749f6f77a216467 (diff)
downloadslskd-f0231b87dc5d06933876be2f57fa0b27753c355b.tar.gz
trim trailing slashes from root paths
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Application/SharedFileCache.cs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/slskd/Application/SharedFileCache.cs b/src/slskd/Application/SharedFileCache.cs
index 7bd30d2a..52c75ed1 100644
--- a/src/slskd/Application/SharedFileCache.cs
+++ b/src/slskd/Application/SharedFileCache.cs
@@ -406,11 +406,13 @@ namespace slskd
LocalPath = share;
}
- Mask = Compute.MaskHash(System.IO.Directory.GetParent(LocalPath).FullName);
+ var parent = System.IO.Directory.GetParent(LocalPath).FullName.TrimEnd('/', '\\');
- var maskedPath = LocalPath.ReplaceFirst(System.IO.Directory.GetParent(LocalPath).FullName, Mask);
+ Mask = Compute.MaskHash(parent);
- var aliasedSegment = LocalPath[(System.IO.Directory.GetParent(LocalPath).FullName.Length + 1)..];
+ var maskedPath = LocalPath.ReplaceFirst(parent, Mask);
+
+ var aliasedSegment = LocalPath[(parent.Length + 1)..];
RemotePath = maskedPath.ReplaceFirst(aliasedSegment, Alias);
}