mirror of
https://github.com/Sonarr/Sonarr
synced 2026-04-19 19:51:59 +02:00
Prevent empty path from breaking custom script validation
This commit is contained in:
parent
06c6062531
commit
0d80c093ff
1 changed files with 11 additions and 3 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using FluentValidation;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Annotations;
|
||||
using NzbDrone.Core.Validation;
|
||||
using NzbDrone.Core.Validation.Paths;
|
||||
|
|
@ -9,9 +10,16 @@ public class CustomScriptSettingsValidator : AbstractValidator<CustomScriptSetti
|
|||
{
|
||||
public CustomScriptSettingsValidator()
|
||||
{
|
||||
RuleFor(c => c.Path).IsValidPath();
|
||||
RuleFor(c => c.Path).SetValidator(new SystemFolderValidator()).WithMessage("Must not be a descendant of '{systemFolder}'");
|
||||
RuleFor(c => c.Arguments).Empty().WithMessage("Arguments are no longer supported for custom scripts");
|
||||
RuleFor(c => c.Path)
|
||||
.Cascade(CascadeMode.Stop)
|
||||
.NotEmpty()
|
||||
.IsValidPath()
|
||||
.SetValidator(new SystemFolderValidator())
|
||||
.WithMessage("Must not be a descendant of '{systemFolder}'");
|
||||
|
||||
RuleFor(c => c.Arguments)
|
||||
.Empty()
|
||||
.WithMessage("Arguments are no longer supported for custom scripts");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue