From 7e68e2c7f480b86c7dfe8ffc2074e89857feb545 Mon Sep 17 00:00:00 2001 From: Bryce Buchanan <75274611+bryce-b@users.noreply.github.com> Date: Tue, 5 Nov 2024 07:18:09 -0800 Subject: [PATCH] [7.17] encoding fixes (#198857) ## Summary Fixes encoding errors where only the first `replace` match was getting replaced. --- packages/elastic-apm-synthtrace/src/lib/utils/create_picker.ts | 2 +- .../metrics_explorer/components/helpers/create_tsvb_link.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/elastic-apm-synthtrace/src/lib/utils/create_picker.ts b/packages/elastic-apm-synthtrace/src/lib/utils/create_picker.ts index 7fce23b6fc966..54cbf585c9f25 100644 --- a/packages/elastic-apm-synthtrace/src/lib/utils/create_picker.ts +++ b/packages/elastic-apm-synthtrace/src/lib/utils/create_picker.ts @@ -8,7 +8,7 @@ export function createPicker(fields: string[]) { const wildcards = fields .filter((field) => field.endsWith('.*')) - .map((field) => field.replace('*', '')); + .map((field) => field.replace(/\*/g, '')); return (value: unknown, key: string) => { return fields.includes(key) || wildcards.some((field) => key.startsWith(field)); diff --git a/x-pack/plugins/infra/public/pages/metrics/metrics_explorer/components/helpers/create_tsvb_link.ts b/x-pack/plugins/infra/public/pages/metrics/metrics_explorer/components/helpers/create_tsvb_link.ts index 4c3551db3cbcd..ae492d344b3e6 100644 --- a/x-pack/plugins/infra/public/pages/metrics/metrics_explorer/components/helpers/create_tsvb_link.ts +++ b/x-pack/plugins/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, '\\"'); const groupByFilters = Array.isArray(options.groupBy) ? options.groupBy .map((field, index) => {