From 78c0ecfdcf3668f01edba63cec33f1f17e5fc14b Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 9 Feb 2026 20:03:07 -0800 Subject: [PATCH] admin: clean namespace validation duplication --- weed/admin/static/js/s3tables.js | 6 ------ weed/admin/view/app/s3tables_namespaces.templ | 12 ++++-------- weed/admin/view/app/s3tables_namespaces_templ.go | 2 +- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/weed/admin/static/js/s3tables.js b/weed/admin/static/js/s3tables.js index aafee0ece..3d5816bb2 100644 --- a/weed/admin/static/js/s3tables.js +++ b/weed/admin/static/js/s3tables.js @@ -731,12 +731,6 @@ function s3TablesNamespaceNameError(name) { if (!part) { return 'namespace levels cannot be empty'; } - if (part === '.' || part === '..') { - return "namespace name parts cannot be '.' or '..'"; - } - if (part.length < 1 || part.length > 255) { - return 'Namespace name must be between 1 and 255 characters'; - } if (!isLowercaseLetterOrDigit(part[0])) { return 'Namespace name must start with a letter or digit'; } diff --git a/weed/admin/view/app/s3tables_namespaces.templ b/weed/admin/view/app/s3tables_namespaces.templ index b35b23d98..4c203ea19 100644 --- a/weed/admin/view/app/s3tables_namespaces.templ +++ b/weed/admin/view/app/s3tables_namespaces.templ @@ -250,14 +250,10 @@ templ S3TablesNamespaces(data dash.S3TablesNamespacesData) { message = 'namespace levels cannot be empty'; break; } - if (part === '.' || part === '..') { - message = "namespace name parts cannot be '.' or '..'"; - break; - } - const start = part[0]; - const end = part[part.length - 1]; - const isStartValid = (start >= 'a' && start <= 'z') || (start >= '0' && start <= '9'); - const isEndValid = (end >= 'a' && end <= 'z') || (end >= '0' && end <= '9'); + const start = part[0]; + const end = part[part.length - 1]; + const isStartValid = (start >= 'a' && start <= 'z') || (start >= '0' && start <= '9'); + const isEndValid = (end >= 'a' && end <= 'z') || (end >= '0' && end <= '9'); if (!isStartValid) { message = 'Namespace name must start with a letter or digit'; break; diff --git a/weed/admin/view/app/s3tables_namespaces_templ.go b/weed/admin/view/app/s3tables_namespaces_templ.go index 6eb8c820e..21962b8c0 100644 --- a/weed/admin/view/app/s3tables_namespaces_templ.go +++ b/weed/admin/view/app/s3tables_namespaces_templ.go @@ -242,7 +242,7 @@ func S3TablesNamespaces(data dash.S3TablesNamespacesData) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "\">
Use lowercase letters, numbers, and underscores. Use dots for nested namespaces (for example, analytics.daily).
Delete Namespace

Are you sure you want to delete the namespace ?

") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "\">
Use lowercase letters, numbers, and underscores. Use dots for nested namespaces (for example, analytics.daily).
Delete Namespace

Are you sure you want to delete the namespace ?

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err }