From 6f42c34585a875e26791c24b57b3207f944495f2 Mon Sep 17 00:00:00 2001 From: mertmit Date: Thu, 18 Apr 2024 21:12:44 +0000 Subject: [PATCH] fix: replace spaces only for databricks --- packages/nocodb/src/services/tables.service.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/nocodb/src/services/tables.service.ts b/packages/nocodb/src/services/tables.service.ts index 3dc052db5e..e7645ebe22 100644 --- a/packages/nocodb/src/services/tables.service.ts +++ b/packages/nocodb/src/services/tables.service.ts @@ -76,14 +76,16 @@ export class TablesService { ); } + if (source.type === 'databricks') { + param.table.table_name = param.table.table_name.replace(/\s/g, '_'); + } + if (source.isMeta(true) && base.prefix && !source.isMeta(true, 1)) { if (!param.table.table_name.startsWith(base.prefix)) { param.table.table_name = `${base.prefix}${param.table.table_name}`; } } - param.table.table_name = param.table.table_name.replace(/ /g, '_'); - param.table.table_name = DOMPurify.sanitize(param.table.table_name); // validate table name @@ -514,6 +516,13 @@ export class TablesService { ); } + if (source.type === 'databricks') { + tableCreatePayLoad.table_name = tableCreatePayLoad.table_name.replace( + /\s/g, + '_', + ); + } + if (source.is_meta && base.prefix) { if (!tableCreatePayLoad.table_name.startsWith(base.prefix)) { tableCreatePayLoad.table_name = `${base.prefix}_${tableCreatePayLoad.table_name}`; @@ -521,7 +530,7 @@ export class TablesService { } tableCreatePayLoad.table_name = DOMPurify.sanitize( - tableCreatePayLoad.table_name.replace(/ /g, '_'), + tableCreatePayLoad.table_name, ); // validate table name