From 189cf8bba2e6267fc2c4e7497f78c7965ed6c2ab Mon Sep 17 00:00:00 2001 From: Nathan L Smith Date: Thu, 31 Oct 2024 02:51:57 -0500 Subject: [PATCH] [8.16] Fix code scanning alert no. 456: Incomplete string escaping or encoding (#193909) (#198242) # Backport This will backport the following commits from `main` to `8.16`: - Fix code scanning alert no. 456: Incomplete string escaping or encoding (#193909) (7458ff11) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) --- .../metrics_explorer/components/helpers/create_tsvb_link.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/observability_solution/infra/public/pages/metrics/metrics_explorer/components/helpers/create_tsvb_link.ts b/x-pack/plugins/observability_solution/infra/public/pages/metrics/metrics_explorer/components/helpers/create_tsvb_link.ts index ee64069cea737..e07011b6ebc62 100644 --- a/x-pack/plugins/observability_solution/infra/public/pages/metrics/metrics_explorer/components/helpers/create_tsvb_link.ts +++ b/x-pack/plugins/observability_solution/infra/public/pages/metrics/metrics_explorer/components/helpers/create_tsvb_link.ts @@ -125,7 +125,7 @@ export const createFilterFromOptions = ( if (!value) { return null; } - return `${field}: "${value.replace('"', '\\"')}"`; + return `${field}: "${value.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`; }) .join(' and ') : `${options.groupBy} : "${id}"`;