From c4e446e7923030d4e3f7436174c438db36a08bea Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Sat, 9 Sep 2023 11:01:39 +0530 Subject: [PATCH] fix sqlite single quote in cdf --- .../smartsheet/column/DefaultValue.vue | 44 +++++++------------ .../smartsheet/column/SelectOptions.vue | 7 +-- 2 files changed, 17 insertions(+), 34 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/column/DefaultValue.vue b/packages/nc-gui/components/smartsheet/column/DefaultValue.vue index 431a361499..0f0bddae68 100644 --- a/packages/nc-gui/components/smartsheet/column/DefaultValue.vue +++ b/packages/nc-gui/components/smartsheet/column/DefaultValue.vue @@ -1,31 +1,34 @@ diff --git a/packages/nc-gui/components/smartsheet/column/SelectOptions.vue b/packages/nc-gui/components/smartsheet/column/SelectOptions.vue index 6918e0a97b..80ad301b42 100644 --- a/packages/nc-gui/components/smartsheet/column/SelectOptions.vue +++ b/packages/nc-gui/components/smartsheet/column/SelectOptions.vue @@ -101,11 +101,6 @@ onMounted(() => { } if (vModel.value.cdf) { - // Postgres returns default value wrapped with single quotes & casted with type so we have to get value between single quotes to keep it unified for all databases - if (isPg.value) { - vModel.value.cdf = vModel.value.cdf.substring(vModel.value.cdf.indexOf(`'`) + 1, vModel.value.cdf.lastIndexOf(`'`)) - } - // Mysql escapes single quotes with backslash so we keep quotes but others have to unescaped if (!isMysql.value) { vModel.value.cdf = vModel.value.cdf.replace(/''/g, "'") @@ -187,7 +182,7 @@ watch(inputs, () => { // Removes the Select Option from cdf if the option is removed watch(vModel.value, (next) => { - const cdfs = (next.cdf ?? '').replaceAll("'", '').split(',') + const cdfs = (next.cdf ?? '').split(',') const values = (next.colOptions.options ?? []).map((col) => { return col.title.replaceAll("'", '') })