Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#3083] improve(web): update regular expression of metalake and catalog name (#3087)

Qian Xiad3efbaf996c4
diff --git a/web/src/app/metalakes/CreateMetalakeDialog.js b/web/src/app/metalakes/CreateMetalakeDialog.js
index 6fcb417def..788c92c8da 100644
--- a/web/src/app/metalakes/CreateMetalakeDialog.js
+++ b/web/src/app/metalakes/CreateMetalakeDialog.js
@@ -45,7 +45,7 @@ const schema = yup.object().shape({
.required()
.matches(
nameRegex,
- 'This field must start with a letter or underscore, and can only contain letters, numbers, and underscores'
+ 'This field must start with a letter or underscore, and can only contain letters, numbers, dashes, and underscores'
)
})
diff --git a/web/src/app/metalakes/metalake/rightContent/CreateCatalogDialog.js b/web/src/app/metalakes/metalake/rightContent/CreateCatalogDialog.js
index cfab9e650d..a6ff296de5 100644
--- a/web/src/app/metalakes/metalake/rightContent/CreateCatalogDialog.js
+++ b/web/src/app/metalakes/metalake/rightContent/CreateCatalogDialog.js
@@ -54,7 +54,7 @@ const schema = yup.object().shape({
.required()
.matches(
nameRegex,
- 'This field must start with a letter or underscore, and can only contain letters, numbers, and underscores'
+ 'This field must start with a letter or underscore, and can only contain letters, numbers, dashes, and underscores'
),
type: yup.mixed().oneOf(['relational', 'fileset', 'messaging']).required(),
provider: yup.string().when('type', (type, schema) => {
diff --git a/web/src/lib/utils/regex.js b/web/src/lib/utils/regex.js
index 6a19ccea7a..7f8c039a07 100644
--- a/web/src/lib/utils/regex.js
+++ b/web/src/lib/utils/regex.js
@@ -3,6 +3,6 @@
* This software is licensed under the Apache License version 2.
*/
-export const nameRegex = /^[a-zA-Z_][a-zA-Z0-9_]*$/
+export const nameRegex = /^[a-zA-Z_-][a-zA-Z0-9_-]*$/
export const keyRegex = /^[a-zA-Z_][a-zA-Z0-9-_.]*$/