aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Common/Validation/AbsoluteFilePathAttribute.cs
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2026-05-07 17:13:28 -0500
committerJP Dillingham <jp@dillingham.me>2026-05-07 17:13:28 -0500
commitfb600f5b90e6c313635687414b50869bf86ab653 (patch)
treed50d0c2837ef97d451a1e68b9a5c200d8678b6e8 /src/slskd/Common/Validation/AbsoluteFilePathAttribute.cs
parent43524239edba37a1e7b8b9a8e34a0c8f31c4f332 (diff)
downloadslskd-fb600f5b90e6c313635687414b50869bf86ab653.tar.gz
add a validator for relative paths
Diffstat (limited to 'src/slskd/Common/Validation/AbsoluteFilePathAttribute.cs')
-rw-r--r--src/slskd/Common/Validation/AbsoluteFilePathAttribute.cs58
1 files changed, 0 insertions, 58 deletions
diff --git a/src/slskd/Common/Validation/AbsoluteFilePathAttribute.cs b/src/slskd/Common/Validation/AbsoluteFilePathAttribute.cs
deleted file mode 100644
index 8f87e479..00000000
--- a/src/slskd/Common/Validation/AbsoluteFilePathAttribute.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-// <copyright file="AbsoluteFilePathAttribute.cs" company="JP Dillingham">
-// ▄▄▄▄ ▄▄▄▄ ▄▄▄▄
-// ▄▄▄▄▄▄█ █▄▄▄▄▄█ █▄▄▄▄▄█ █
-// █__ --█ █__ --█ ◄█ - █
-// █▄▄▄▄▄█▄▄█▄▄▄▄▄█▄▄█▄▄█▄▄▄▄▄█
-// ┍━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ━━━━ ━ ━┉ ┉ ┉
-// │ Copyright (c) JP Dillingham.
-// │
-// │ This program is free software: you can redistribute it and/or modify
-// │ it under the terms of the GNU Affero General Public License as published
-// │ by the Free Software Foundation, version 3.
-// │
-// │ This program is distributed in the hope that it will be useful,
-// │ but WITHOUT ANY WARRANTY; without even the implied warranty of
-// │ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// │ GNU Affero General Public License for more details.
-// │
-// │ You should have received a copy of the GNU Affero General Public License
-// │ along with this program. If not, see https://www.gnu.org/licenses/.
-// │
-// │ This program is distributed with Additional Terms pursuant to Section 7
-// │ of the AGPLv3. See the LICENSE file in the root directory of this
-// │ project for the complete terms and conditions.
-// │
-// │ https://slskd.org
-// │
-// ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ╌ ╌╌╌╌ ╌
-// │ SPDX-FileCopyrightText: JP Dillingham
-// │ SPDX-License-Identifier: AGPL-3.0-only
-// ╰───────────────────────────────────────────╶──── ─ ─── ─ ── ──┈ ┈
-// </copyright>
-
-namespace slskd.Validation
-{
- using System.ComponentModel.DataAnnotations;
- using System.IO;
-
- /// <summary>
- /// Validates that the specified path is absolute.
- /// </summary>
- public class AbsoluteFilePathAttribute : ValidationAttribute
- {
- protected override ValidationResult IsValid(object value, ValidationContext validationContext)
- {
- if (value != null)
- {
- var filePath = value.ToString();
-
- if (!string.IsNullOrEmpty(filePath) && !Path.IsPathRooted(filePath))
- {
- return new ValidationResult($"The {validationContext.DisplayName} field must specify an absolute file path.");
- }
- }
-
- return ValidationResult.Success;
- }
- }
-} \ No newline at end of file