Always validate Custom Script path
This commit is contained in:
parent
c3dcc542da
commit
c922cc5dc6
|
@ -363,14 +363,6 @@ namespace NzbDrone.Core.Notifications.CustomScript
|
||||||
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 @@ namespace NzbDrone.Core.Notifications.CustomScript
|
||||||
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