Skip to content

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

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

claude[bot]53f1e8171761
diff --git a/packages/nc-gui/composables/useColumnCreateStore.ts b/packages/nc-gui/composables/useColumnCreateStore.ts
index 4b7fcd310d..a1d8fdd671 100644
--- a/packages/nc-gui/composables/useColumnCreateStore.ts
+++ b/packages/nc-gui/composables/useColumnCreateStore.ts
@@ -252,9 +252,9 @@ const [useProvideColumnCreateStore, useColumnCreateStore] = createInjectionState
? activeTabSelectedFields.value.some((c) => {
return (
c.ai_temp_id !== formState.value?.ai_temp_id &&
- ((value || '').toLowerCase().trim() === (c.formState?.column_name || '').toLowerCase().trim() ||
- (value || '').toLowerCase().trim() === (c.formState?.title || '').toLowerCase().trim() ||
- (value || '').toLowerCase().trim() === (c?.title || '').toLowerCase().trim())
+ ((value || '').trim().toLowerCase() === (c.formState?.column_name || '').trim().toLowerCase() ||
+ (value || '').trim().toLowerCase() === (c.formState?.title || '').trim().toLowerCase() ||
+ (value || '').trim().toLowerCase() === (c?.title || '').trim().toLowerCase())
)
})
: false
@@ -265,8 +265,8 @@ const [useProvideColumnCreateStore, useColumnCreateStore] = createInjectionState
(c) =>
c.id !== formState.value.id && // ignore current column
// compare against column_name and title
- ((value || '').toLowerCase() === (c.column_name || '').toLowerCase() ||
- (value || '').toLowerCase() === (c.title || '').toLowerCase()),
+ ((value || '').trim().toLowerCase() === (c.column_name || '').trim().toLowerCase() ||
+ (value || '').trim().toLowerCase() === (c.title || '').trim().toLowerCase()),
) ||
isAiFieldExist)
) {
@@ -385,6 +385,11 @@ const [useProvideColumnCreateStore, useColumnCreateStore] = createInjectionState
try {
isSaving.value = true // set saving state
+ // trim title before saving
+ if (formState.value.title) {
+ formState.value.title = formState.value.title.trim()
+ }
+
formState.value.table_name = meta.value?.table_name
const refModelId = formState.value.custom?.ref_model_id
diff --git a/packages/nc-gui/composables/useIntegrationsStore.ts b/packages/nc-gui/composables/useIntegrationsStore.ts
index 5c565ad539..47dc9d0dda 100644
--- a/packages/nc-gui/composables/useIntegrationsStore.ts
+++ b/packages/nc-gui/composables/useIntegrationsStore.ts
@@ -224,6 +224,11 @@ const [useProvideIntegrationViewStore, _useIntegrationStore] = useInjectionState
$e('a:integration:update')
try {
+ // trim title before saving
+ if (integration.title) {
+ integration.title = integration.title.trim()
+ }
+
await api.integration.update(integration.id, integration)
if (integration.type === IntegrationsType.Ai) {
@@ -291,6 +296,11 @@ const [useProvideIntegrationViewStore, _useIntegrationStore] = useInjectionState
}
try {
+ // trim title before saving
+ if (integration.title) {
+ integration.title = integration.title.trim()
+ }
+
const response = await api.integration.create(integration)
if (response && response?.id) {
diff --git a/packages/nc-gui/composables/useMcpSettings.ts b/packages/nc-gui/composables/useMcpSettings.ts
index 25c8c6953e..c8105c68b5 100644
--- a/packages/nc-gui/composables/useMcpSettings.ts
+++ b/packages/nc-gui/composables/useMcpSettings.ts
@@ -63,6 +63,11 @@ export const useMcpSettings = createSharedComposable(() => {
try {
isCreatingMcpToken.value = true
+ // trim title before saving
+ if (newMcpTokenTitle.value) {
+ newMcpTokenTitle.value = newMcpTokenTitle.value.trim()
+ }
+
const response = await $api.internal.postOperation(
activeWorkspaceId.value,
activeProjectId.value,