From ee296fa1165aa100b7a72e25a90af49b70109f97 Mon Sep 17 00:00:00 2001 From: Pranay Kumar Karvi Date: Mon, 24 Feb 2025 13:03:41 +0530 Subject: [PATCH] [#6399] Added validation to fileset dialog (#6400) ### What changes were proposed in this pull request? The validation schema for the `key` field within the `propItems` array was modified to allow hyphens in file names. The regular expression for the `key` was updated to: ```js /^[a-zA-Z_][a-zA-Z0-9_-]*$/ ``` ### Why are the changes needed? Fix: issue #6399 The UI was incorrectly rejecting file names containing hyphens when creating a fileset, even though hyphens were allowed in the name specification. The changes ensure that hyphens are properly validated as part of the file name. ### Does this PR introduce any user-facing change? Yes, this PR allows users to use hyphens in file names when creating a files ### How was this patch tested? The changes were tested by creating filesets with hyphens in the names via the UI, ensuring they were accepted correctly. --------- Co-authored-by: Qian Xia --- web/web/src/lib/utils/regex.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/web/src/lib/utils/regex.js b/web/web/src/lib/utils/regex.js index 072211785b1..161253367f2 100644 --- a/web/web/src/lib/utils/regex.js +++ b/web/web/src/lib/utils/regex.js @@ -17,9 +17,9 @@ * under the License. */ -export const nameRegex = /^\w[\w]{0,63}$/ +export const nameRegex = /^\w[\w/=-]{0,63}$/ export const nameRegexDesc = - 'This field must begin with a letter or underscore, contain only alphanumeric characters or underscores, and be between 1 and 64 characters in length' + 'This field must start with a letter, digit, or underscore, can include alphanumeric characters, underscores, slashes (/), equal signs (=), or hyphens (-), and must be between 1 and 64 characters long.' export const keyRegex = /^[a-zA-Z_][a-zA-Z0-9-_.]*$/