aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Providers/DirectoryService.cs
diff options
context:
space:
mode:
authorKGT1 <kilian.gamn@gmx.de>2026-05-03 22:35:57 +0200
committerGitHub <noreply@github.com>2026-05-03 22:35:57 +0200
commit4464b2e2ed9d8cc3f4c520ee76dfedac3557cf0d (patch)
tree4fdf6dc5fff74c21b3b2cd74c1d3d5fd695b0638 /MediaBrowser.Controller/Providers/DirectoryService.cs
parent950c6525d1ab456115c4ee80b8fed86c5a81eaf5 (diff)
parent622947e37425f3620432995cde5d4a0809d91694 (diff)
Merge branch 'jellyfin:master' into removeGenericConfigurationEndpoint
Diffstat (limited to 'MediaBrowser.Controller/Providers/DirectoryService.cs')
-rw-r--r--MediaBrowser.Controller/Providers/DirectoryService.cs31
1 files changed, 29 insertions, 2 deletions
diff --git a/MediaBrowser.Controller/Providers/DirectoryService.cs b/MediaBrowser.Controller/Providers/DirectoryService.cs
index a1edfa3c96..5b5af75a47 100644
--- a/MediaBrowser.Controller/Providers/DirectoryService.cs
+++ b/MediaBrowser.Controller/Providers/DirectoryService.cs
@@ -3,6 +3,7 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using MediaBrowser.Model.IO;
@@ -26,7 +27,20 @@ namespace MediaBrowser.Controller.Providers
public FileSystemMetadata[] GetFileSystemEntries(string path)
{
- return _cache.GetOrAdd(path, static (p, fileSystem) => fileSystem.GetFileSystemEntries(p).ToArray(), _fileSystem);
+ return _cache.GetOrAdd(
+ path,
+ static (p, fileSystem) =>
+ {
+ try
+ {
+ return fileSystem.GetFileSystemEntries(p).ToArray();
+ }
+ catch (DirectoryNotFoundException)
+ {
+ return [];
+ }
+ },
+ _fileSystem);
}
public List<FileSystemMetadata> GetDirectories(string path)
@@ -98,7 +112,20 @@ namespace MediaBrowser.Controller.Providers
_filePathCache.TryRemove(path, out _);
}
- var filePaths = _filePathCache.GetOrAdd(path, static (p, fileSystem) => fileSystem.GetFilePaths(p).ToList(), _fileSystem);
+ var filePaths = _filePathCache.GetOrAdd(
+ path,
+ static (p, fileSystem) =>
+ {
+ try
+ {
+ return fileSystem.GetFilePaths(p).ToList();
+ }
+ catch (DirectoryNotFoundException)
+ {
+ return [];
+ }
+ },
+ _fileSystem);
if (sort)
{