Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import type {
EChartHighlightHandler,
ReactEchartsRef,
} from 'sentry/types/echarts';
import {defined} from 'sentry/utils';
import {defined, escape} from 'sentry/utils';
import {uniq} from 'sentry/utils/array/uniq';
import type {AggregationOutputType} from 'sentry/utils/discover/fields';
import {RangeMap, type Range} from 'sentry/utils/number/rangeMap';
Expand Down Expand Up @@ -348,8 +348,17 @@ export function TimeSeriesWidgetVisualization(props: TimeSeriesWidgetVisualizati
return defined(sampleId) ? sampleId.toString() : seriesName;
}

const name = aliases[seriesName] ?? seriesName;
return truncationFormatter(name, true);
const alias = aliases[seriesName];
if (alias) {
// The alias value comes from `plottable.label` and is not
// HTML-escaped. Escape it for safe insertion into raw HTML
// tooltip strings.
return escape(truncationFormatter(alias, true, false));
}
// `seriesName` is already HTML-escaped by `getFormatter`, so
// skip escaping to avoid double-encoding (e.g., `>` → `>`
// → `>`).
return truncationFormatter(seriesName, true, false);
},
valueFormatter: function (value, _field, valueFormatterParams) {
// Use the series to figure out the corresponding `Plottable`, and get the field type. From that, use whichever unit we chose for that field type.
Expand Down
Loading