From 5f090860722296672fc2e6ed9c2b7a64bbe046af Mon Sep 17 00:00:00 2001 From: Marta Bondyra Date: Mon, 14 Oct 2024 17:41:54 +0200 Subject: [PATCH] [Lens] escape backslash characters in the formula input --- .../form_based/operations/definitions/formula/generate.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/generate.ts b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/generate.ts index a2f94fb437062..b13c3ff261207 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/generate.ts +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/formula/generate.ts @@ -79,7 +79,7 @@ export function generateFormula( } previousFormula += (previousColumn.filter.language === 'kuery' ? 'kql=' : 'lucene=') + - `'${previousColumn.filter.query.replace(/'/g, `\\'`)}'`; // replace all + `'${previousColumn.filter.query.replace(/\\/g, '\\\\').replace(/'/g, `\\'`)}'`; // replace all } if (previousColumn.timeShift) { if (