From e67d8ce077a2400318e5532e04b63cbf8925a39c Mon Sep 17 00:00:00 2001 From: Jacob Casper Date: Sun, 8 May 2022 18:04:19 -0500 Subject: [PATCH] Don't let permission denied kill library scans I have a single `./Movies` directory that contains symlinks to many other directories, some of which are in shared paths. Other daemons sometimes overwrite permissions on these paths and prevent Jellyfin from being able to scan. Because this exception is unhandled within a LINQ statement it can randomly kill the metadata refresh for my entire Movies library. Running with this patch has allowed me to at least add + scan for movies in directories that Jellyfin can currently access and gives me some notification of the symlinks failing due to permissions errors. (cherry picked from commit 193cc8690a60bc2a432df14d256f00371e055c90) --- Emby.Server.Implementations/IO/ManagedFileSystem.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Emby.Server.Implementations/IO/ManagedFileSystem.cs b/Emby.Server.Implementations/IO/ManagedFileSystem.cs index 399ece7fd0..120b1812a7 100644 --- a/Emby.Server.Implementations/IO/ManagedFileSystem.cs +++ b/Emby.Server.Implementations/IO/ManagedFileSystem.cs @@ -262,6 +262,10 @@ namespace Emby.Server.Implementations.IO _logger.LogError(ex, "Reading the file size of the symlink at {Path} failed. Marking the file as not existing.", fileInfo.FullName); result.Exists = false; } + catch (UnauthorizedAccessException ex) + { + _logger.LogError(ex, "Reading the file at {Path} failed due to a permissions exception.", fileInfo.FullName); + } } }