From ad4991c9434a8fbf5657e693c809b4888f65a32a Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Wed, 1 Jun 2022 17:12:22 +0800 Subject: [PATCH] fix: avoid extra single quote added by knex binding --- packages/nocodb/src/lib/dataMapper/lib/sql/conditionV2.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nocodb/src/lib/dataMapper/lib/sql/conditionV2.ts b/packages/nocodb/src/lib/dataMapper/lib/sql/conditionV2.ts index d7c1f3abd8..461619b324 100644 --- a/packages/nocodb/src/lib/dataMapper/lib/sql/conditionV2.ts +++ b/packages/nocodb/src/lib/dataMapper/lib/sql/conditionV2.ts @@ -221,7 +221,7 @@ const parseConditionV2 = async ( case 'like': if (column.uidt === UITypes.Formula) { [field, val] = [val, field]; - val = `%${val}%`.replace("%'", '%').replace("'%", '%'); + val = `%${val}%`.replace(/^%'([\s\S]*)'%$/, '%$1%') } else { val = `%${val}%`; } @@ -234,7 +234,7 @@ const parseConditionV2 = async ( case 'nlike': if (column.uidt === UITypes.Formula) { [field, val] = [val, field]; - val = `%${val}%`.replace("%'", '%').replace("'%", '%'); + val = `%${val}%`.replace(/^%'([\s\S]*)'%$/, '%$1%') } else { val = `%${val}%`; }