Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

feat(frontend): extend trim validation to additional name fields

claude[bot]5ce7fd0fccf8
diff --git a/packages/nc-gui/components/dashboard/TreeView/Table/Node.vue b/packages/nc-gui/components/dashboard/TreeView/Table/Node.vue
index bbeb92fcaf..8b62bc8f89 100644
--- a/packages/nc-gui/components/dashboard/TreeView/Table/Node.vue
+++ b/packages/nc-gui/components/dashboard/TreeView/Table/Node.vue
@@ -110,7 +110,7 @@ const validators = computed(() => {
return new Promise<void>((resolve, reject) => {
if (
!(tables?.value || []).every(
- (t) => t.id === table.value.id || t.title.toLowerCase() !== (value?.trim() || '').toLowerCase(),
+ (t) => t.id === table.value.id || t.title?.trim().toLowerCase() !== (value?.trim() || '').toLowerCase(),
)
) {
return reject(new Error('Duplicate table alias'))
diff --git a/packages/nc-gui/components/dlg/Table/Create.vue b/packages/nc-gui/components/dlg/Table/Create.vue
index bf35365fb1..cd4dbc2b03 100644
--- a/packages/nc-gui/components/dlg/Table/Create.vue
+++ b/packages/nc-gui/components/dlg/Table/Create.vue
@@ -300,7 +300,7 @@ const validators = computed(() => {
validator: (_: any, value: any) => {
// validate duplicate alias
return new Promise((resolve, reject) => {
- if ((tables.value || []).some((t) => t.title === (value || '') && t.source_id === customSourceId.value)) {
+ if ((tables.value || []).some((t) => t.title?.trim() === (value || '').trim() && t.source_id === customSourceId.value)) {
return reject(new Error('Duplicate table alias'))
}
return resolve(true)
diff --git a/packages/nc-gui/components/webhook/index.vue b/packages/nc-gui/components/webhook/index.vue
index 4dc0848942..1a0894d8d0 100644
--- a/packages/nc-gui/components/webhook/index.vue
+++ b/packages/nc-gui/components/webhook/index.vue
@@ -654,6 +654,7 @@ async function saveHooks() {
if (hookRef.id) {
res = await api.dbTableWebhook.update(hookRef.id, {
...hookRef,
+ title: hookRef.title.trim(),
operation: operations,
notification: {
...hookRef.notification,
@@ -663,6 +664,7 @@ async function saveHooks() {
} else {
res = await api.dbTableWebhook.create(meta.value!.id!, {
...hookRef,
+ title: hookRef.title.trim(),
operation: operations,
notification: {
...hookRef.notification,