From 7b08cf42d6938fe91c72cf36504133e48001b3a2 Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Mon, 25 May 2026 18:16:28 +1000 Subject: Added basic string sanitization to ApiMediaController --- Util.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Util.cs') diff --git a/Util.cs b/Util.cs index 6af6c81..7de2b6e 100644 --- a/Util.cs +++ b/Util.cs @@ -5,6 +5,11 @@ public static class Extensions { "K", "M", "G", "T", "P", "E", "Z", "Y", "R", "Q" }; + public static string? NullIfEmpty(this string s) { + s = s.Trim(); + return string.IsNullOrEmpty(s) ? null : s; + } + public static DateTime? TryParseDateTimeUtc(this string s) { bool success = DateTime.TryParse(s, out var dateTime); return success ? DateTime.SpecifyKind(dateTime, DateTimeKind.Utc) : null; -- cgit v1.3