From e75579e3e41862e791e7cd70824523b7c1e388b9 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 12 Aug 2025 12:53:05 +0200 Subject: [PATCH] fixes --- DEPLOYMENT_FORCE_UPDATE.md | 10 +++++++--- server/api/admin/nocodb-config.post.ts | 19 ++++++++++++++++++- server/api/admin/nocodb-test.post.ts | 17 +++++++++++++++++ 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/DEPLOYMENT_FORCE_UPDATE.md b/DEPLOYMENT_FORCE_UPDATE.md index 5a821fc..1616555 100644 --- a/DEPLOYMENT_FORCE_UPDATE.md +++ b/DEPLOYMENT_FORCE_UPDATE.md @@ -2,8 +2,8 @@ This file was created to force a deployment update to include the Events and RSVPs table configuration fields in the admin dialog. -**Updated**: 2025-08-12 12:43 PM -**Reason**: Add missing Events and RSVPs table configuration to production build - FIXED CORRECT COMPONENT +**Updated**: 2025-08-12 12:49 PM +**Reason**: Add missing Events and RSVPs table configuration + Fix API token validation ## Changes Included: - ✅ Events Table ID configuration field @@ -11,6 +11,10 @@ This file was created to force a deployment update to include the Events and RSV - ✅ Updated AdminConfigurationDialog component (the actual production component) - ✅ Fixed TypeScript errors - ✅ Added proper form validation for new fields +- ✅ Fixed ByteString conversion error in API token validation +- ✅ Added proper API token validation (no special Unicode characters) ## Root Cause Identified: -Production was using AdminConfigurationDialog.vue, not NocoDBSettingsDialog.vue. The correct component has now been updated. +1. Production was using AdminConfigurationDialog.vue, not NocoDBSettingsDialog.vue +2. API tokens with special characters (bullets, quotes) cause HTTP header errors +3. Both issues have now been resolved diff --git a/server/api/admin/nocodb-config.post.ts b/server/api/admin/nocodb-config.post.ts index 40d26ac..6acfbca 100644 --- a/server/api/admin/nocodb-config.post.ts +++ b/server/api/admin/nocodb-config.post.ts @@ -35,7 +35,24 @@ export default defineEventHandler(async (event) => { if (!body.url || !body.apiKey || !body.baseId || !body.tables) { throw createError({ statusCode: 400, - statusMessage: 'All fields are required: url, apiKey, baseId, tables' + statusMessage: 'Missing required fields: url, apiKey, baseId, tables' + }); + } + + // Validate API token format - check for non-ASCII characters that would cause ByteString errors + const apiKey = body.apiKey.trim(); + if (!/^[\x00-\xFF]*$/.test(apiKey)) { + throw createError({ + statusCode: 400, + statusMessage: 'API token contains invalid characters. Please ensure you copied the token correctly without any special formatting characters.' + }); + } + + // Additional validation for common token issues + if (apiKey.includes('•') || apiKey.includes('…') || apiKey.includes('"') || apiKey.includes('"')) { + throw createError({ + statusCode: 400, + statusMessage: 'API token contains formatting characters (bullets, quotes, etc.). Please copy the raw token from NocoDB without any formatting.' }); } diff --git a/server/api/admin/nocodb-test.post.ts b/server/api/admin/nocodb-test.post.ts index 4802c19..f1baa69 100644 --- a/server/api/admin/nocodb-test.post.ts +++ b/server/api/admin/nocodb-test.post.ts @@ -47,6 +47,23 @@ export default defineEventHandler(async (event) => { }; } + // Validate API token format - check for non-ASCII characters that would cause ByteString errors + const apiKey = body.apiKey.trim(); + if (!/^[\x00-\xFF]*$/.test(apiKey)) { + return { + success: false, + message: 'API token contains invalid characters. Please ensure you copied the token correctly without any special formatting characters.' + }; + } + + // Additional validation for common token issues + if (apiKey.includes('•') || apiKey.includes('…') || apiKey.includes('"') || apiKey.includes('"')) { + return { + success: false, + message: 'API token contains formatting characters (bullets, quotes, etc.). Please copy the raw token from NocoDB without any formatting.' + }; + } + console.log('[api/admin/nocodb-test.post] Testing NocoDB connection...'); console.log('[api/admin/nocodb-test.post] URL:', body.url); console.log('[api/admin/nocodb-test.post] Base ID:', body.baseId);