diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2021-08-06 10:31:09 -0500 |
|---|---|---|
| committer | JP Dillingham <jpdillingham@gmail.com> | 2021-08-06 10:31:09 -0500 |
| commit | f6b798d3f53b630f0d5a4b2dd8e5f0c154bbe4b0 (patch) | |
| tree | 3c084733e6cadfb62ade01b226a6b1d2af0f5cb4 /src/slskd/Application/SharedFileCache.cs | |
| parent | b8053991348e73501494af0faa37222f4d98253f (diff) | |
| download | slskd-f6b798d3f53b630f0d5a4b2dd8e5f0c154bbe4b0.tar.gz | |
mask filenames as we convert to a dictionary
Diffstat (limited to 'src/slskd/Application/SharedFileCache.cs')
| -rw-r--r-- | src/slskd/Application/SharedFileCache.cs | 4 |
1 files changed, 2 insertions, 2 deletions
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++; |
