From f6b798d3f53b630f0d5a4b2dd8e5f0c154bbe4b0 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Fri, 6 Aug 2021 10:31:09 -0500 Subject: mask filenames as we convert to a dictionary --- src/slskd/Application/SharedFileCache.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/slskd/Application/SharedFileCache.cs') diff --git a/src/slskd/Application/SharedFileCache.cs b/src/slskd/Application/SharedFileCache.cs index f52f298a..b03d3019 100644 --- a/src/slskd/Application/SharedFileCache.cs +++ b/src/slskd/Application/SharedFileCache.cs @@ -161,7 +161,7 @@ namespace slskd // filename and with a value of a Soulseek.File object var newFiles = System.IO.Directory.GetFiles(directory, "*", SearchOption.TopDirectoryOnly) .Select(f => new File(1, f.Replace("/", @"\").ReplaceFirst(mask.Value, mask.Key), new FileInfo(f).Length, Path.GetExtension(f))) - .ToDictionary(f => f.Filename, f => f); + .ToDictionary(f => f.Filename.ReplaceFirst(mask.Value, mask.Key), f => f); // merge the new dictionary with the rest this will overwrite any duplicate keys, but keys are the fully // qualified name the only time this *should* cause problems is if one of the shares is a subdirectory of another. @@ -172,7 +172,7 @@ namespace slskd Log.Warning($"File {file.Key} shared in directory {directory} has already been cached. This is probably a misconfiguration of the shared directories (is a subdirectory being re-shared?)."); } - files[file.Key.ReplaceFirst(mask.Value, mask.Key)] = file.Value; + files[file.Key] = file.Value; } current++; -- cgit v1.2.3