Skip to content

Commit

Permalink
[#6399] Added validation to fileset dialog (#6502)
Browse files Browse the repository at this point in the history
### 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 <pranaykarvi@gmail.com>
Co-authored-by: Qian Xia <lauraxiaqian@gmail.com>
  • Loading branch information
3 people authored Feb 24, 2025
1 parent d565a30 commit ff457d9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions web/web/src/lib/utils/regex.js
Original file line number Diff line number Diff line change
Expand Up @@ -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-_.]*$/

0 comments on commit ff457d9

Please sign in to comment.