diff options
| author | JPVenson <github@jpb.email> | 2025-02-05 18:32:13 +0000 |
|---|---|---|
| committer | JPVenson <github@jpb.email> | 2025-02-05 18:32:13 +0000 |
| commit | dfdef511a5b855ee4e4f079236ff43cb508958d5 (patch) | |
| tree | db2c5d8cfe13817b165c1d24495947d98c25f670 /Emby.Server.Implementations/IO/ManagedFileSystem.cs | |
| parent | 078587d232ccbfdf6e08c6f1a6435e4e397e4bdc (diff) | |
| parent | 00b66a06eac4d1331d59a6a9b7de3e99088ebaa9 (diff) | |
Merge remote-tracking branch 'jellyfinorigin/master' into feature/pgsql_provider
Diffstat (limited to 'Emby.Server.Implementations/IO/ManagedFileSystem.cs')
| -rw-r--r-- | Emby.Server.Implementations/IO/ManagedFileSystem.cs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/IO/ManagedFileSystem.cs b/Emby.Server.Implementations/IO/ManagedFileSystem.cs index 46c128ded..66b7839f7 100644 --- a/Emby.Server.Implementations/IO/ManagedFileSystem.cs +++ b/Emby.Server.Implementations/IO/ManagedFileSystem.cs @@ -276,6 +276,13 @@ namespace Emby.Server.Implementations.IO { _logger.LogError(ex, "Reading the file at {Path} failed due to a permissions exception.", fileInfo.FullName); } + catch (IOException ex) + { + // IOException generally means the file is not accessible due to filesystem issues + // Catch this exception and mark the file as not exist to ignore it + _logger.LogError(ex, "Reading the file at {Path} failed due to an IO Exception. Marking the file as not existing", fileInfo.FullName); + result.Exists = false; + } } } @@ -590,6 +597,9 @@ namespace Emby.Server.Implementations.IO /// <inheritdoc /> public virtual IEnumerable<FileSystemMetadata> GetFileSystemEntries(string path, bool recursive = false) { + // Note: any of unhandled exceptions thrown by this method may cause the caller to believe the whole path is not accessible. + // But what causing the exception may be a single file under that path. This could lead to unexpected behavior. + // For example, the scanner will remove everything in that path due to unhandled errors. var directoryInfo = new DirectoryInfo(path); var enumerationOptions = GetEnumerationOptions(recursive); |
