diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-06-04 18:07:07 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-06-04 18:07:07 -0500 |
| commit | 483e37f64def66cecb01a8c471d35e2937178960 (patch) | |
| tree | eec853ed52bef304cc50d1bb0ca17cd3f8484f30 /src/slskd/Common/Validation/AbsolutePathAttribute.cs | |
| parent | e5d362836ce8892487864170abdc31fc032989c5 (diff) | |
| download | slskd-483e37f64def66cecb01a8c471d35e2937178960.tar.gz | |
change how property injection impacts path validation
Diffstat (limited to 'src/slskd/Common/Validation/AbsolutePathAttribute.cs')
| -rw-r--r-- | src/slskd/Common/Validation/AbsolutePathAttribute.cs | 13 |
1 files changed, 1 insertions, 12 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."); } |
