From e3fb0ca87db9fa522a6d1b2b2e362118f042d9eb Mon Sep 17 00:00:00 2001 From: Pranav C Date: Wed, 6 Dec 2023 17:26:24 +0530 Subject: [PATCH 1/3] fix: escape single quote properly and update default value by overriding the col object Signed-off-by: Pranav C --- packages/nocodb/src/services/columns.service.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/nocodb/src/services/columns.service.ts b/packages/nocodb/src/services/columns.service.ts index 0a6e904059..f572c60c88 100644 --- a/packages/nocodb/src/services/columns.service.ts +++ b/packages/nocodb/src/services/columns.service.ts @@ -444,12 +444,7 @@ export class ColumnsService { } // handle single quote for default value - if ( - driverType === 'mysql' || - driverType === 'mysql2' || - driverType === 'pg' || - driverType === 'sqlite3' - ) { + if (driverType === 'pg' || driverType === 'sqlite3') { colBody.cdf = colBody.cdf.replace(/'/g, "'"); } else { colBody.cdf = colBody.cdf.replace(/'/g, "''"); From 035fdf41a1642b56412204897f7146d814e2f503 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Mon, 11 Dec 2023 14:48:31 +0530 Subject: [PATCH 2/3] fix: escape single quote properly and update default value by overriding the col object Signed-off-by: Pranav C --- packages/nc-gui/components/smartsheet/column/DefaultValue.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/column/DefaultValue.vue b/packages/nc-gui/components/smartsheet/column/DefaultValue.vue index 5fdf44c7eb..13a777368a 100644 --- a/packages/nc-gui/components/smartsheet/column/DefaultValue.vue +++ b/packages/nc-gui/components/smartsheet/column/DefaultValue.vue @@ -27,8 +27,8 @@ const cdfValue = ref(null) const editEnabled = ref(false) const updateCdfValue = (cdf: string | null) => { - vModel.value.cdf = cdf - cdfValue.value = vModel.value.cdf + vModel.value = { ...vModel.value, cdf } + cdfValue.value = cdf } onMounted(() => { From a7d3d7335f7fe09a33c08e90e389f45f581fd0f1 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Mon, 11 Dec 2023 15:10:03 +0530 Subject: [PATCH 3/3] fix: handle single quote while adding column Signed-off-by: Pranav C --- packages/nocodb/src/services/columns.service.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/nocodb/src/services/columns.service.ts b/packages/nocodb/src/services/columns.service.ts index f572c60c88..09cecbd6e6 100644 --- a/packages/nocodb/src/services/columns.service.ts +++ b/packages/nocodb/src/services/columns.service.ts @@ -1295,12 +1295,7 @@ export class ColumnsService { } // handle single quote for default value - if ( - driverType === 'mysql' || - driverType === 'mysql2' || - driverType === 'pg' || - driverType === 'sqlite3' - ) { + if (driverType === 'pg' || driverType === 'sqlite3') { colBody.cdf = colBody.cdf.replace(/'/g, "'"); } else { colBody.cdf = colBody.cdf.replace(/'/g, "''");