diff options
| author | Claus Vium <cvium@users.noreply.github.com> | 2024-03-18 16:09:00 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-18 09:09:00 -0600 |
| commit | 239727e8967c87610e4807b2b8051a3d33aac131 (patch) | |
| tree | 6f75c269148faa0b05bd57c21a542a40bcc5b9a5 /Emby.Server.Implementations/IO/ManagedFileSystem.cs | |
| parent | 7c141b97094b5546e7b91e0eceb510d7bd1145f4 (diff) | |
fix: skip library folders that are inaccessible or empty (#9291)
Diffstat (limited to 'Emby.Server.Implementations/IO/ManagedFileSystem.cs')
| -rw-r--r-- | Emby.Server.Implementations/IO/ManagedFileSystem.cs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Emby.Server.Implementations/IO/ManagedFileSystem.cs b/Emby.Server.Implementations/IO/ManagedFileSystem.cs index c380d67db..67854a2a7 100644 --- a/Emby.Server.Implementations/IO/ManagedFileSystem.cs +++ b/Emby.Server.Implementations/IO/ManagedFileSystem.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Globalization; using System.IO; using System.Linq; +using System.Security; using Jellyfin.Extensions; using MediaBrowser.Common.Configuration; using MediaBrowser.Model.IO; @@ -643,7 +644,15 @@ namespace Emby.Server.Implementations.IO /// <inheritdoc /> public virtual IEnumerable<string> GetFileSystemEntryPaths(string path, bool recursive = false) { - return Directory.EnumerateFileSystemEntries(path, "*", GetEnumerationOptions(recursive)); + try + { + return Directory.EnumerateFileSystemEntries(path, "*", GetEnumerationOptions(recursive)); + } + catch (Exception ex) when (ex is UnauthorizedAccessException or DirectoryNotFoundException or SecurityException) + { + _logger.LogError(ex, "Failed to enumerate path {Path}", path); + return Enumerable.Empty<string>(); + } } /// <inheritdoc /> |
