From 5e9e578101f8bed30941ff053df9f86bc58773b8 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Fri, 4 Aug 2023 15:12:40 +0300 Subject: [PATCH] Ensure path is valid before watching it (cherry picked from commit 1245b2c58b5a1b5fb4aee9a4f974ecfb131de2bd) --- src/NzbDrone.Core/MediaFiles/RootFolderWatchingService.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/NzbDrone.Core/MediaFiles/RootFolderWatchingService.cs b/src/NzbDrone.Core/MediaFiles/RootFolderWatchingService.cs index 5e088211f..b674bdb07 100644 --- a/src/NzbDrone.Core/MediaFiles/RootFolderWatchingService.cs +++ b/src/NzbDrone.Core/MediaFiles/RootFolderWatchingService.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Threading.Tasks; using NLog; using NzbDrone.Common.Disk; +using NzbDrone.Common.EnsureThat; using NzbDrone.Common.Extensions; using NzbDrone.Common.TPL; using NzbDrone.Core.Configuration; @@ -116,6 +117,9 @@ namespace NzbDrone.Core.MediaFiles private void StartWatchingPath(string path) { + Ensure.That(path, () => path).IsNotNullOrWhiteSpace(); + Ensure.That(path, () => path).IsValidPath(PathValidationType.CurrentOs); + // Already being watched if (_fileSystemWatchers.ContainsKey(path)) {