This is an automated email from the ASF dual-hosted git repository.
jshao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push:
new ee296fa116 [#6399] Added validation to fileset dialog (#6400)
ee296fa116 is described below
commit ee296fa1165aa100b7a72e25a90af49b70109f97
Author: Pranay Kumar Karvi <[email protected]>
AuthorDate: Mon Feb 24 13:03:41 2025 +0530
[#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 <[email protected]>
---
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 072211785b..161253367f 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-_.]*$/