From 50e9ea1696600889953214943393210e59dc5a05 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Wed, 16 Oct 2024 07:39:57 +1100 Subject: [PATCH] [8.15] [Canvas] Fix unescaped backslashes (#196311) (#196428) # Backport This will backport the following commits from `main` to `8.15`: - [[Canvas] Fix unescaped backslashes (#196311)](https://github.com/elastic/kibana/pull/196311) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Nick Peihl --- .../public/components/expression_input/autocomplete.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/presentation_util/public/components/expression_input/autocomplete.ts b/src/plugins/presentation_util/public/components/expression_input/autocomplete.ts index be592b430f0e5..2f656e5df8466 100644 --- a/src/plugins/presentation_util/public/components/expression_input/autocomplete.ts +++ b/src/plugins/presentation_util/public/components/expression_input/autocomplete.ts @@ -438,7 +438,7 @@ function maybeQuote(value: any) { if (value.match(/^\{.*\}$/)) { return value; } - return `"${value.replace(/"/g, '\\"')}"`; + return `"${value.replace(/[\\"]/g, '\\$&')}"`; } return value; }