mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
# Backport This will backport the following commits from `main` to `8.6`: - [Fix escaping of double quote (#150039)](https://github.com/elastic/kibana/pull/150039) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Thomas Watson","email":"watson@elastic.co"},"sourceCommit":{"committedDate":"2023-02-01T14:00:22Z","message":"Fix escaping of double quote (#150039)\n\nThe previous version of `escapeSearchQueryPhrase` didn't escape\r\nanything.","sha":"13853a4a5bc70726ddf9168b13eea0e8013bf360","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","backport:all-open","v8.7.0"],"number":150039,"url":"https://github.com/elastic/kibana/pull/150039","mergeCommit":{"message":"Fix escaping of double quote (#150039)\n\nThe previous version of `escapeSearchQueryPhrase` didn't escape\r\nanything.","sha":"13853a4a5bc70726ddf9168b13eea0e8013bf360"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/150039","number":150039,"mergeCommit":{"message":"Fix escaping of double quote (#150039)\n\nThe previous version of `escapeSearchQueryPhrase` didn't escape\r\nanything.","sha":"13853a4a5bc70726ddf9168b13eea0e8013bf360"}}]}] BACKPORT--> Co-authored-by: Thomas Watson <watson@elastic.co>
This commit is contained in:
parent
1c89d27ff7
commit
9a1a960b46
2 changed files with 2 additions and 2 deletions
|
@ -18,7 +18,7 @@ describe('Saved object service', () => {
|
|||
it('should escape quotes', () => {
|
||||
const res = escapeSearchQueryPhrase('test1"test2');
|
||||
|
||||
expect(res).toEqual(`"test1\"test2"`);
|
||||
expect(res).toEqual(`"test1\\"test2"`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -16,7 +16,7 @@ import type { ListWithKuery } from '../types';
|
|||
* @param val
|
||||
*/
|
||||
export function escapeSearchQueryPhrase(val: string): string {
|
||||
return `"${val.replace(/["]/g, '"')}"`;
|
||||
return `"${val.replace(/["]/g, '\\"')}"`;
|
||||
}
|
||||
|
||||
// Adds `.attributes` to any kuery strings that are missing it, this comes from
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue