From 9dff8664821c1a1a02357a7c77040d436ab578a3 Mon Sep 17 00:00:00 2001 From: Johannes Date: Fri, 13 Dec 2024 09:12:14 +0100 Subject: [PATCH] updated regex for ValidateIdString --- PCAxis.Sql/ApiUtils/ApiUtil.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PCAxis.Sql/ApiUtils/ApiUtil.cs b/PCAxis.Sql/ApiUtils/ApiUtil.cs index 382ec78..6a9086c 100644 --- a/PCAxis.Sql/ApiUtils/ApiUtil.cs +++ b/PCAxis.Sql/ApiUtils/ApiUtil.cs @@ -97,9 +97,9 @@ private static string ValidateIdString(string input) throw new ArgumentException("The id string cannot be null."); } - if (!Regex.IsMatch(input, @"^[a-zA-Z0-9._\s]+$", RegexOptions.None, TimeSpan.FromSeconds(2))) + if (!Regex.IsMatch(input, @"^[\w\t \-:.]+$", RegexOptions.None, TimeSpan.FromSeconds(2))) { - throw new ArgumentException("The string contains invalid characters. Only digits, letters, underscores, periods and spaces are allowed."); + throw new ArgumentException("The string contains invalid characters. Only letters, digits, underscores, tabs, spaces, hyphens, colons and periods are allowed."); } return input; }