diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2021-09-20 21:53:58 -0500 |
|---|---|---|
| committer | JP Dillingham <jpdillingham@gmail.com> | 2021-09-20 21:53:58 -0500 |
| commit | f0231b87dc5d06933876be2f57fa0b27753c355b (patch) | |
| tree | f568ca55d4e3d259386c8c8ed60a8e81b81c5198 /src/slskd/Application/SharedFileCache.cs | |
| parent | f7e774d83cea066c079fbcd1d749f6f77a216467 (diff) | |
| download | slskd-f0231b87dc5d06933876be2f57fa0b27753c355b.tar.gz | |
trim trailing slashes from root paths
Diffstat (limited to 'src/slskd/Application/SharedFileCache.cs')
| -rw-r--r-- | src/slskd/Application/SharedFileCache.cs | 8 |
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); } |
