From 47279b0f173c1abd9dad671cdb4bbd91259becd3 Mon Sep 17 00:00:00 2001 From: Bryce Buchanan <75274611+bryce-b@users.noreply.github.com> Date: Wed, 6 Nov 2024 11:02:41 -0800 Subject: [PATCH] added '\' escapes (#199185) ## Summary This PR adds backslash escaping to previous code scan fixes. (cherry picked from commit fb7114222b5bde5846fdda85a2ae0e94797600e2) # Conflicts: # x-pack/plugins/observability_solution/infra/public/pages/metrics/metrics_explorer/components/helpers/create_tsvb_link.ts --- .../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 e07011b6ebc62..e41d191549c5a 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 @@ -114,7 +114,7 @@ export const createFilterFromOptions = ( filters.push(options.filterQuery); } if (options.groupBy) { - const id = series.id.replace('"', '\\"'); + const id = series.id.replace(/\\/g, '\\\\').replace(/"/g, '\\"'); const groupByFilters = Array.isArray(options.groupBy) ? options.groupBy .map((field, index) => {