1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-16 16:04:08 +01:00

Fixed: Skip invalid movie paths during validation

(cherry picked from commit 378fedcd9dcb0fe07585727dd7d9e5e765c863c0)

Closes #10079
This commit is contained in:
Mark McDowall 2024-06-10 20:30:03 -07:00 committed by Bogdan
parent 194926c7dd
commit a12ff68fbd
3 changed files with 14 additions and 3 deletions

View File

@ -37,6 +37,12 @@ public MoveMovieService(IMovieService movieService,
private void MoveSingleMovie(Movie movie, string sourcePath, string destinationPath, int? index = null, int? total = null)
{
if (!sourcePath.IsPathValid(PathValidationType.CurrentOs))
{
_logger.Warn("Folder '{0}' for '{1}' is invalid, unable to move movie. Try moving files manually", sourcePath, movie.Title);
return;
}
if (!_diskProvider.FolderExists(sourcePath))
{
_logger.Debug("Folder '{0}' for '{1}' does not exist, not moving.", sourcePath, movie.Title);

View File

@ -1,5 +1,6 @@
using System.Linq;
using FluentValidation.Validators;
using NzbDrone.Common.Disk;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Movies;
@ -28,7 +29,10 @@ protected override bool IsValid(PropertyValidatorContext context)
context.MessageFormatter.AppendArgument("path", context.PropertyValue.ToString());
return !_moviesService.AllMoviePaths().Any(s => s.Value.PathEquals(context.PropertyValue.ToString()) && s.Key != instanceId);
// Skip the path for this movie and any invalid paths
return !_moviesService.AllMoviePaths().Any(s => s.Key != instanceId &&
s.Value.IsPathValid(PathValidationType.CurrentOs) &&
s.Value.PathEquals(context.PropertyValue.ToString()));
}
}
}

View File

@ -1,4 +1,5 @@
using FluentValidation.Validators;
using FluentValidation.Validators;
using NzbDrone.Common.Disk;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.RootFolders;
@ -24,7 +25,7 @@ protected override bool IsValid(PropertyValidatorContext context)
return true;
}
return !_rootFolderService.All().Exists(r => r.Path.PathEquals(context.PropertyValue.ToString()));
return !_rootFolderService.All().Exists(r => r.Path.IsPathValid(PathValidationType.CurrentOs) && r.Path.PathEquals(context.PropertyValue.ToString()));
}
}
}