Loki: Fix wrongly escaped label values when using LabelFilter (#59812)

* change backticks to quotes

* add unescaping to `addFilterAsLabelFilter`

* fix removal of wrong quotes

* change unescape order
This commit is contained in:
Sven Grossmann
2022-12-06 12:30:03 +01:00
committed by GitHub
parent 78ef55eb06
commit 932349b5ab
6 changed files with 95 additions and 39 deletions

View File

@@ -571,6 +571,21 @@ describe('buildVisualQueryFromString', () => {
})
);
});
it('parses simple query with quotes in label value', () => {
expect(buildVisualQueryFromString('{app="\\"frontend\\""}')).toEqual(
noErrors({
labels: [
{
op: '=',
value: '\\"frontend\\"',
label: 'app',
},
],
operations: [],
})
);
});
});
function noErrors(query: LokiVisualQuery) {