diff --git a/src/NzbDrone.Common/Disk/OsPath.cs b/src/NzbDrone.Common/Disk/OsPath.cs index 5071c5ebe..27d9b4f56 100644 --- a/src/NzbDrone.Common/Disk/OsPath.cs +++ b/src/NzbDrone.Common/Disk/OsPath.cs @@ -153,6 +153,14 @@ namespace NzbDrone.Common.Disk } } + public bool IsValid + { + get + { + return _path.IsPathValid(); + } + } + private int GetFileNameIndex() { if (_path.Length < 2) diff --git a/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceFixture.cs b/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceFixture.cs index 3412219c5..ea7b3dc14 100644 --- a/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceFixture.cs +++ b/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceFixture.cs @@ -381,6 +381,30 @@ namespace NzbDrone.Core.Test.Download AssertCompletedDownload(); } + [Test] + public void should_warn_if_path_is_not_valid_for_windows() + { + WindowsOnly(); + + _trackedDownload.DownloadItem.OutputPath = new OsPath(@"/invalid/Windows/Path"); + + Subject.Process(_trackedDownload); + + AssertNoAttemptedImport(); + } + + [Test] + public void should_warn_if_path_is_not_valid_for_linux() + { + MonoOnly(); + + _trackedDownload.DownloadItem.OutputPath = new OsPath(@"C:\Invalid\Mono\Path"); + + Subject.Process(_trackedDownload); + + AssertNoAttemptedImport(); + } + private void AssertNoAttemptedImport() { Mocker.GetMock() diff --git a/src/NzbDrone.Core/Download/CompletedDownloadService.cs b/src/NzbDrone.Core/Download/CompletedDownloadService.cs index b4910f9a0..aafada077 100644 --- a/src/NzbDrone.Core/Download/CompletedDownloadService.cs +++ b/src/NzbDrone.Core/Download/CompletedDownloadService.cs @@ -3,6 +3,8 @@ using System.IO; using System.Linq; using NLog; using NzbDrone.Common.Disk; +using NzbDrone.Common.EnsureThat; +using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.Extensions; using NzbDrone.Core.Configuration; using NzbDrone.Core.Download.TrackedDownloads; @@ -72,6 +74,13 @@ namespace NzbDrone.Core.Download return; } + if ((OsInfo.IsWindows && !downloadItemOutputPath.IsWindowsPath) || + (OsInfo.IsNotWindows && !downloadItemOutputPath.IsUnixPath)) + { + trackedDownload.Warn("[{0}] is not a valid local path. You may need a Remote Path Mapping.", downloadItemOutputPath); + return; + } + var downloadedEpisodesFolder = new OsPath(_configService.DownloadedEpisodesFolder); if (downloadedEpisodesFolder.Contains(downloadItemOutputPath))