fixes
All checks were successful
Build And Push Image / docker (push) Successful in 3m6s

This commit is contained in:
2025-08-12 12:53:05 +02:00
parent 22dbbae150
commit e75579e3e4
3 changed files with 42 additions and 4 deletions

View File

@@ -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.'
});
}

View File

@@ -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);