Fix use of thread-unsafe List<T>.Sort()

This commit is contained in:
Gabriel Luci 2026-05-04 23:46:00 -04:00
parent ec04313317
commit 6f2e42c20c
4 changed files with 16 additions and 21 deletions

View file

@ -105,7 +105,7 @@ namespace MediaBrowser.Controller.Providers
public IReadOnlyList<string> GetFilePaths(string path)
=> GetFilePaths(path, false);
public IReadOnlyList<string> GetFilePaths(string path, bool clearCache, bool sort = false)
public IReadOnlyList<string> GetFilePaths(string path, bool clearCache)
{
if (clearCache)
{
@ -118,7 +118,7 @@ namespace MediaBrowser.Controller.Providers
{
try
{
return fileSystem.GetFilePaths(p).ToList();
return fileSystem.GetFilePaths(p).OrderBy(x => x).ToList();
}
catch (DirectoryNotFoundException)
{
@ -127,11 +127,6 @@ namespace MediaBrowser.Controller.Providers
},
_fileSystem);
if (sort)
{
filePaths.Sort();
}
return filePaths;
}

View file

@ -21,7 +21,7 @@ namespace MediaBrowser.Controller.Providers
IReadOnlyList<string> GetFilePaths(string path);
IReadOnlyList<string> GetFilePaths(string path, bool clearCache, bool sort = false);
IReadOnlyList<string> GetFilePaths(string path, bool clearCache);
bool IsAccessible(string path);
}