mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00

New: Download client UI matches other settings Fixed: Prevent drone factory folder from being set to invalid paths/root path for series Fixed: Switching pages in settings will not hide changes Fixed: Test download clients Fixed: Settings are validated before saving
28 lines
750 B
C#
28 lines
750 B
C#
using FluentValidation;
|
|
using FluentValidation.Validators;
|
|
using NzbDrone.Common;
|
|
|
|
namespace NzbDrone.Core.Validation.Paths
|
|
{
|
|
public static class PathValidation
|
|
{
|
|
public static IRuleBuilderOptions<T, string> IsValidPath<T>(this IRuleBuilder<T, string> ruleBuilder)
|
|
{
|
|
return ruleBuilder.SetValidator(new PathValidator());
|
|
}
|
|
}
|
|
|
|
public class PathValidator : PropertyValidator
|
|
{
|
|
public PathValidator()
|
|
: base("Invalid Path")
|
|
{
|
|
}
|
|
|
|
protected override bool IsValid(PropertyValidatorContext context)
|
|
{
|
|
if (context.PropertyValue == null) return false;
|
|
return context.PropertyValue.ToString().IsPathValid();
|
|
}
|
|
}
|
|
} |