This is an automated email from the ASF dual-hosted git repository.
jshao pushed a commit to branch branch-0.8
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/branch-0.8 by this push:
new ff457d93b6 [#6399] Added validation to fileset dialog (#6502)
ff457d93b6 is described below
commit ff457d93b63bbc537fc391473ed9952354d0270b
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Feb 24 16:56:37 2025 +0800
[#6399] Added validation to fileset dialog (#6502)
### 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: Pranay Kumar Karvi <[email protected]>
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-_.]*$/