mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
More descriptive validation error for Movie Path
This commit is contained in:
parent
c51fe81f41
commit
135251ec31
@ -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 New Issue
Block a user