diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Common/Validation/AbsolutePathAttribute.cs | 13 | ||||
| -rw-r--r-- | src/slskd/Common/Validation/RelativePathAttribute.cs | 13 |
2 files changed, 2 insertions, 24 deletions
diff --git a/src/slskd/Common/Validation/AbsolutePathAttribute.cs b/src/slskd/Common/Validation/AbsolutePathAttribute.cs index 9393e524..f2615315 100644 --- a/src/slskd/Common/Validation/AbsolutePathAttribute.cs +++ b/src/slskd/Common/Validation/AbsolutePathAttribute.cs @@ -58,20 +58,9 @@ namespace slskd.Validation { var path = value.ToString(); - // this property can only be set via reflection in a unit test; this is here only to make this testable - if (Injected.HasValue) - { - if (!FileSafety.IsPathAbsolute(path, os: Injected)) - { - return new ValidationResult($"The {validationContext.DisplayName} field must be an absolute path."); - } - - return ValidationResult.Success; - } - if (OS == OperatingSystem.Current) { - if (!FileSafety.IsPathAbsolute(path, os: Compute.OperatingSystem())) + if (!FileSafety.IsPathAbsolute(path, os: Injected ?? Compute.OperatingSystem())) { return new ValidationResult($"The {validationContext.DisplayName} field must be an absolute path on the current operating system."); } diff --git a/src/slskd/Common/Validation/RelativePathAttribute.cs b/src/slskd/Common/Validation/RelativePathAttribute.cs index 1bdbd4fb..f691d4e5 100644 --- a/src/slskd/Common/Validation/RelativePathAttribute.cs +++ b/src/slskd/Common/Validation/RelativePathAttribute.cs @@ -59,20 +59,9 @@ namespace slskd.Validation { var path = value.ToString(); - // this property can only be set via reflection in a unit test; this is here only to make this testable - if (Injected.HasValue) - { - if (!FileSafety.IsPathRelative(path, os: Injected)) - { - return new ValidationResult($"The {validationContext.DisplayName} field must be a relative path on the current operating system."); - } - - return ValidationResult.Success; - } - if (OS == OperatingSystem.Current) { - if (!FileSafety.IsPathRelative(path, os: Compute.OperatingSystem())) + if (!FileSafety.IsPathRelative(path, os: Injected ?? Compute.OperatingSystem())) { return new ValidationResult($"The {validationContext.DisplayName} field must be a relative path on all operating systems."); } |
