diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-06-04 08:07:48 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-06-04 08:07:48 -0500 |
| commit | e5d362836ce8892487864170abdc31fc032989c5 (patch) | |
| tree | 087b20a4517c755e56e714d18b42aeb013e66543 /src | |
| parent | 7e0bc2227cc8593b65e3acd587cbc783e561ca6a (diff) | |
| download | slskd-e5d362836ce8892487864170abdc31fc032989c5.tar.gz | |
fix junk
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Common/FileSafety.cs | 5 | ||||
| -rw-r--r-- | src/slskd/Common/Validation/RelativePathAttribute.cs | 31 |
2 files changed, 2 insertions, 34 deletions
diff --git a/src/slskd/Common/FileSafety.cs b/src/slskd/Common/FileSafety.cs index b72d3749..a07de6d1 100644 --- a/src/slskd/Common/FileSafety.cs +++ b/src/slskd/Common/FileSafety.cs @@ -176,11 +176,8 @@ public static class FileSafety return false; } - Console.WriteLine($"IsPathAbsolute? path: {path}, os: {os}, iswindows? {System.OperatingSystem.IsWindows()}"); - if (os.HasValue ? os.Value == OperatingSystem.Windows : System.OperatingSystem.IsWindows()) { - Console.WriteLine("Windows!"); // Windows drive-letter path: X:\ or X:/ // X:foo is relative on windows if (path.Length >= 3 @@ -200,8 +197,6 @@ public static class FileSafety return false; } - Console.WriteLine("Linux!"); - // Unix/Linux/macOS absolute paths and UNC paths with forward slashes start with / if (path.StartsWith('/')) { diff --git a/src/slskd/Common/Validation/RelativePathAttribute.cs b/src/slskd/Common/Validation/RelativePathAttribute.cs index 62185a42..1bdbd4fb 100644 --- a/src/slskd/Common/Validation/RelativePathAttribute.cs +++ b/src/slskd/Common/Validation/RelativePathAttribute.cs @@ -83,38 +83,11 @@ namespace slskd.Validation // OS == OperatingSystem.All or .Any; if (!FileSafety.IsPathRelative(path, os: OperatingSystem.Linux) || !FileSafety.IsPathRelative(path, os: OperatingSystem.Windows)) { - // this can only be exercised via unit tests; OSPlatform can't be passeed as an attribute argument - // so, this takes precedent over PlatformAgnostic - if (!FileSafety.IsPathRelative(path, os: OS)) - { - return new ValidationResult($"The {validationContext.DisplayName} field must be a relative path."); - } - } - else - { - if (!PlatformAgnostic) - { - if (!FileSafety.IsPathRelative(path, os: null)) // this OS - { - return new ValidationResult($"The {validationContext.DisplayName} field must be a relative path."); - } - } - else - { - if (!FileSafety.IsPathRelative(path, os: OSPlatform.Linux)) - { - return new ValidationResult($"The {validationContext.DisplayName} field must be a relative path."); - } - - if (!FileSafety.IsPathRelative(path, os: OSPlatform.Windows)) - { - return new ValidationResult($"The {validationContext.DisplayName} field must be a relative path."); - } - } + return new ValidationResult($"The {validationContext.DisplayName} field must be a relative path."); } } return ValidationResult.Success; } } -} +}
\ No newline at end of file |
