From a6bb66ff8d7748032468ec0c61e6379be8bc064c Mon Sep 17 00:00:00 2001 From: Brian Howe Date: Tue, 5 Dec 2023 22:53:51 -0600 Subject: [PATCH 1/2] Watch library directories with perm errors --- Emby.Server.Implementations/IO/LibraryMonitor.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Emby.Server.Implementations/IO/LibraryMonitor.cs b/Emby.Server.Implementations/IO/LibraryMonitor.cs index dde38906f3..26710ba659 100644 --- a/Emby.Server.Implementations/IO/LibraryMonitor.cs +++ b/Emby.Server.Implementations/IO/LibraryMonitor.cs @@ -330,6 +330,12 @@ namespace Emby.Server.Implementations.IO var ex = e.GetException(); var dw = (FileSystemWatcher)sender; + if (ex.GetType() == typeof(UnauthorizedAccessException)) + { + _logger.LogError(ex, "Permission error for Directory watcher: {Path}", dw.Path); + return; + } + _logger.LogError(ex, "Error in Directory watcher for: {Path}", dw.Path); DisposeWatcher(dw, true); From b3522170d148953128f309fe52f51fe4319bf718 Mon Sep 17 00:00:00 2001 From: Brian Howe <30811239+bhowe34@users.noreply.github.com> Date: Wed, 6 Dec 2023 22:07:40 -0600 Subject: [PATCH 2/2] Update Emby.Server.Implementations/IO/LibraryMonitor.cs Co-authored-by: Cody Robibero --- Emby.Server.Implementations/IO/LibraryMonitor.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Emby.Server.Implementations/IO/LibraryMonitor.cs b/Emby.Server.Implementations/IO/LibraryMonitor.cs index 26710ba659..507e44f634 100644 --- a/Emby.Server.Implementations/IO/LibraryMonitor.cs +++ b/Emby.Server.Implementations/IO/LibraryMonitor.cs @@ -330,9 +330,9 @@ namespace Emby.Server.Implementations.IO var ex = e.GetException(); var dw = (FileSystemWatcher)sender; - if (ex.GetType() == typeof(UnauthorizedAccessException)) + if (ex is UnauthorizedAccessException unauthorizedAccessException) { - _logger.LogError(ex, "Permission error for Directory watcher: {Path}", dw.Path); + _logger.LogError(unauthorizedAccessException, "Permission error for Directory watcher: {Path}", dw.Path); return; }