Ensure path is valid before watching it

(cherry picked from commit 1245b2c58b5a1b5fb4aee9a4f974ecfb131de2bd)
This commit is contained in:
Bogdan 2023-08-04 15:12:40 +03:00
parent 156407c541
commit 5e9e578101

View file

@ -6,6 +6,7 @@
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 @@ public void Handle(ModelEvent<RootFolder> message)
private void StartWatchingPath(string path)
{
Ensure.That(path, () => path).IsNotNullOrWhiteSpace();
Ensure.That(path, () => path).IsValidPath(PathValidationType.CurrentOs);
// Already being watched
if (_fileSystemWatchers.ContainsKey(path))
{