mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-19 17:32:38 +01:00
Always validate Custom Script path
(cherry picked from commit c922cc5dc617dd776d4523cbf62376821c5a4ad9)
This commit is contained in:
parent
073d15160d
commit
263534717d
@ -336,14 +336,6 @@ public override ValidationResult Test()
|
|||||||
failures.Add(new NzbDroneValidationFailure("Path", "File does not exist"));
|
failures.Add(new NzbDroneValidationFailure("Path", "File does not exist"));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var systemFolder in SystemFolders.GetSystemFolders())
|
|
||||||
{
|
|
||||||
if (systemFolder.IsParentPath(Settings.Path))
|
|
||||||
{
|
|
||||||
failures.Add(new NzbDroneValidationFailure("Path", $"Must not be a descendant of '{systemFolder}'"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (failures.Empty())
|
if (failures.Empty())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -11,6 +11,7 @@ public class CustomScriptSettingsValidator : AbstractValidator<CustomScriptSetti
|
|||||||
public CustomScriptSettingsValidator()
|
public CustomScriptSettingsValidator()
|
||||||
{
|
{
|
||||||
RuleFor(c => c.Path).IsValidPath();
|
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.Arguments).Empty().WithMessage("Arguments are no longer supported for custom scripts");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user