diff --git a/packages/nocodb-sdk/src/lib/formulaHelpers.ts b/packages/nocodb-sdk/src/lib/formulaHelpers.ts index e10e491dea..4d71420952 100644 --- a/packages/nocodb-sdk/src/lib/formulaHelpers.ts +++ b/packages/nocodb-sdk/src/lib/formulaHelpers.ts @@ -179,9 +179,8 @@ export function jsepTreeToFormula(node) { if (node.type === 'Literal') { if (typeof node.value === 'string') { - return '"' + node.value + '"'; + return String.raw`"${escapeDoubleQuotes(node.value)}"`; } - return '' + node.value; } @@ -214,3 +213,7 @@ export function jsepTreeToFormula(node) { return ''; } + +function escapeDoubleQuotes(v: string) { + return v.replace(/"/g, '\\"'); +}