Skip to content

Commit

Permalink
Loki: Escape label-values in context queries (#56614) (#56639)
Browse files Browse the repository at this point in the history
(cherry picked from commit 6267460)

Co-authored-by: Sven Grossmann <Svennergr@gmail.com>
  • Loading branch information
grafanabot and svennergr committed Oct 10, 2022
1 parent c258cfb commit b8aa314
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions public/app/plugins/datasource/loki/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import LanguageProvider from './LanguageProvider';
import { LiveStreams, LokiLiveTarget } from './LiveStreams';
import { transformBackendResult } from './backendResultTransformer';
import { LokiAnnotationsQueryEditor } from './components/AnnotationsQueryEditor';
import { escapeLabelValueInSelector, isRegexSelector } from './languageUtils';
import { escapeLabelValueInExactSelector, escapeLabelValueInSelector, isRegexSelector } from './languageUtils';
import { labelNamesRegex, labelValuesRegex } from './migrations/variableQueryMigrations';
import {
addLabelFormatToQuery,
Expand Down Expand Up @@ -577,7 +577,7 @@ export class LokiDatasource
.map((label: string) => {
if (labels.includes(label)) {
// escape backslashes in label as users can't escape them by themselves
return `${label}="${row.labels[label].replace(/\\/g, '\\\\')}"`;
return `${label}="${escapeLabelValueInExactSelector(row.labels[label])}"`;
}
return '';
})
Expand Down

0 comments on commit b8aa314

Please sign in to comment.