mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
Don't try to process a download client item with an invalid path for the OS
This commit is contained in:
parent
330554edb0
commit
04de0049fe
@ -153,6 +153,14 @@ public string FileName
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsValid
|
||||
{
|
||||
get
|
||||
{
|
||||
return _path.IsPathValid();
|
||||
}
|
||||
}
|
||||
|
||||
private int GetFileNameIndex()
|
||||
{
|
||||
if (_path.Length < 2)
|
||||
|
@ -381,6 +381,30 @@ public void should_mark_as_import_title_mismatch_if_ignore_warnings_is_true()
|
||||
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<IDownloadedEpisodesImportService>()
|
||||
|
@ -3,6 +3,8 @@
|
||||
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 @@ public void Process(TrackedDownload trackedDownload, bool ignoreWarnings = false
|
||||
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))
|
||||
|
Loading…
Reference in New Issue
Block a user