aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2025-08-10 15:29:41 -0500
committerJP Dillingham <jp@dillingham.me>2025-08-10 15:29:41 -0500
commit515440c62cb08943f629dc2f75dcb2201e140465 (patch)
treeadb12e3a872597117967b2e5665e5ce3a6905ee2
parent29c1ee192a64a56171a7d3955e3f0a64b56f0255 (diff)
downloadslskd-515440c62cb08943f629dc2f75dcb2201e140465.tar.gz
snapshot the list of repositories before generating a browse response
-rw-r--r--src/slskd/Shares/ShareService.cs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/slskd/Shares/ShareService.cs b/src/slskd/Shares/ShareService.cs
index 1fd683cc..f2d07305 100644
--- a/src/slskd/Shares/ShareService.cs
+++ b/src/slskd/Shares/ShareService.cs
@@ -160,17 +160,20 @@ namespace slskd.Shares
prefix = share.RemotePath + (share.RemotePath.EndsWith('\\') ? string.Empty : '\\');
}
+ // snapshot the current list of repositories
+ var repositories = AllRepositories.ToList();
+
// Soulseek requires that each directory in the tree have an entry in the list returned in a browse response. if
// missing, files that are nested within directories which contain only directories (no files) are displayed as being
// in the root. to get around this, prime a dictionary with all known directories, and an empty Soulseek.Directory. if
// there are any files in the directory, this entry will be overwritten with a new Soulseek.Directory containing the
// files. if not they'll be left as is.
- foreach (var directory in AllRepositories.SelectMany(r => r.ListDirectories(prefix)))
+ foreach (var directory in repositories.SelectMany(r => r.ListDirectories(prefix)))
{
directories.TryAdd(directory, new Directory(directory));
}
- var files = AllRepositories.SelectMany(r => r.ListFiles(prefix, includeFullPath: true));
+ var files = repositories.SelectMany(r => r.ListFiles(prefix, includeFullPath: true));
var groups = files
.GroupBy(file => file.Filename.GetNormalizedDirectoryName())