aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/IO/ManagedFileSystem.cs
diff options
context:
space:
mode:
authorJPVenson <github@jpb.software>2025-02-21 11:08:09 +0000
committerJPVenson <github@jpb.software>2025-02-21 11:08:09 +0000
commit8c0b0d910229d7691b638d2aee5aa5a8aa07fe17 (patch)
tree2e4177bd57586f9e41747f582dddae9d70d78466 /Emby.Server.Implementations/IO/ManagedFileSystem.cs
parent963f2357a966dd7a5a6ab248155cc52ce066753b (diff)
parent712908d53c7ca38d13e03ea7809e0c40e862a5fb (diff)
Merge remote-tracking branch 'jellyfinorigin/master' into feature/10.10/DetachedMigration
Diffstat (limited to 'Emby.Server.Implementations/IO/ManagedFileSystem.cs')
-rw-r--r--Emby.Server.Implementations/IO/ManagedFileSystem.cs14
1 files changed, 12 insertions, 2 deletions
diff --git a/Emby.Server.Implementations/IO/ManagedFileSystem.cs b/Emby.Server.Implementations/IO/ManagedFileSystem.cs
index 4b68f21d5..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;
+ }
}
}
@@ -561,7 +568,7 @@ namespace Emby.Server.Implementations.IO
{
var enumerationOptions = GetEnumerationOptions(recursive);
- // On linux and osx the search pattern is case sensitive
+ // On linux and macOS the search pattern is case-sensitive
// If we're OK with case-sensitivity, and we're only filtering for one extension, then use the native method
if ((enableCaseSensitiveExtensions || _isEnvironmentCaseInsensitive) && extensions is not null && extensions.Count == 1)
{
@@ -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);
@@ -618,7 +628,7 @@ namespace Emby.Server.Implementations.IO
{
var enumerationOptions = GetEnumerationOptions(recursive);
- // On linux and osx the search pattern is case sensitive
+ // On linux and macOS the search pattern is case-sensitive
// If we're OK with case-sensitivity, and we're only filtering for one extension, then use the native method
if ((enableCaseSensitiveExtensions || _isEnvironmentCaseInsensitive) && extensions is not null && extensions.Length == 1)
{