aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-08-21 07:25:30 -0500
committerJP Dillingham <jpdillingham@gmail.com>2021-08-21 07:25:30 -0500
commit810f8660bcc435bfb6dd4e1be99b8194462b263a (patch)
tree03dad51e033652e6a20793c99fdac397b4e5394d
parentf5f534c23f39599bb83b69a022ba141b6168ff8c (diff)
downloadslskd-810f8660bcc435bfb6dd4e1be99b8194462b263a.tar.gz
stop replacing forward slashes in file paths
-rw-r--r--src/slskd/Application/SharedFileCache.cs20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/slskd/Application/SharedFileCache.cs b/src/slskd/Application/SharedFileCache.cs
index 5ef9be64..06442797 100644
--- a/src/slskd/Application/SharedFileCache.cs
+++ b/src/slskd/Application/SharedFileCache.cs
@@ -99,12 +99,7 @@ namespace slskd
directories.AddOrUpdate(group.Name, group, (_, _) => group);
}
- Console.WriteLine(directories.Values.ToJson());
-
- return directories.Values.OrderBy(f => {
- Console.WriteLine($"Sorting by {f.Name}");
- return f.Name[8..];
- });
+ return directories.Values.OrderBy(f => f.Name[8..]);
}
/// <summary>
@@ -191,7 +186,7 @@ namespace slskd
try
{
var newFiles = System.IO.Directory.GetFiles(directory, "*", SearchOption.TopDirectoryOnly)
- .Select(f => new File(1, f.Replace("/", @"\").ReplaceFirst(share.LocalPath, share.RemotePath), new FileInfo(f).Length, Path.GetExtension(f)))
+ .Select(f => new File(1, f.ReplaceFirst(share.LocalPath, share.RemotePath), new FileInfo(f).Length, Path.GetExtension(f)))
.ToDictionary(f => f.Filename, f => f);
// merge the new dictionary with the rest this will overwrite any duplicate keys, but keys are the fully
@@ -373,15 +368,8 @@ namespace slskd
var maskedPath = LocalPath.ReplaceFirst(System.IO.Directory.GetParent(LocalPath).FullName, Mask);
- if (!string.IsNullOrEmpty(Alias))
- {
- var aliasedSegment = LocalPath[(System.IO.Directory.GetParent(LocalPath).FullName.Length + 1)..];
- RemotePath = maskedPath.ReplaceFirst(aliasedSegment, Alias);
- }
- else
- {
- RemotePath = LocalPath.ReplaceFirst(System.IO.Directory.GetParent(LocalPath).FullName, Mask);
- }
+ var aliasedSegment = LocalPath[(System.IO.Directory.GetParent(LocalPath).FullName.Length + 1)..];
+ RemotePath = maskedPath.ReplaceFirst(aliasedSegment, Alias);
}
public string Alias { get; init; }