item-mixin: Improve Item name validation RegEx (#2658)

`A-z` also matches `[ \ ] ^ _ `, which is not intended.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
pull/2660/head
Florian Hotze 2024-07-09 12:01:56 +02:00 committed by GitHub
parent 2d07d21ebb
commit 553591d72c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -39,7 +39,7 @@ export default {
* @returns {string} The error message if the name is invalid, or an empty string if the name is valid.
*/
validateItemName (name) {
if (!/^[A-z][A-z0-9_]*$/.test(name)) {
if (!/^[A-Za-z][A-Za-z0-9_]*$/.test(name)) {
return 'Required. Must not start with a number. A-Z,a-z,0-9,_ only'
} else if (this.items && this.items.some(item => item.name === name)) {
return 'An Item with this name already exists'