aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Application/SharedFileCache.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/slskd/Application/SharedFileCache.cs')
-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);
}