mirror of
https://github.com/Radarr/Radarr
synced 2025-02-24 15:21:28 +00:00
More descriptive validation error for Movie Path
This commit is contained in:
parent
c51fe81f41
commit
135251ec31
1 changed files with 4 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
|||
using FluentValidation.Validators;
|
||||
using FluentValidation.Validators;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Movies;
|
||||
|
||||
|
@ -9,7 +9,7 @@ public class MoviePathValidator : PropertyValidator
|
|||
private readonly IMovieService _moviesService;
|
||||
|
||||
public MoviePathValidator(IMovieService moviesService)
|
||||
: base("Path is already configured for another movie")
|
||||
: base("Path is already configured for another movie: {moviePath}")
|
||||
{
|
||||
_moviesService = moviesService;
|
||||
}
|
||||
|
@ -24,6 +24,8 @@ protected override bool IsValid(PropertyValidatorContext context)
|
|||
dynamic instance = context.ParentContext.InstanceToValidate;
|
||||
var instanceId = (int)instance.Id;
|
||||
|
||||
context.MessageFormatter.AppendArgument("moviePath", context.PropertyValue.ToString());
|
||||
|
||||
return !_moviesService.GetAllMovies().Exists(s => s.Path.PathEquals(context.PropertyValue.ToString()) && s.Id != instanceId);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue