Skip to content

Commit

Permalink
[8.x] [Graph] Escape backslash characters in the graph encode functio…
Browse files Browse the repository at this point in the history
…ns (elastic#196239) (elastic#196684)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Graph] Escape backslash characters in the graph encode functions
(elastic#196239)](elastic#196239)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Marta
Bondyra","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-17T12:08:23Z","message":"[Graph]
Escape backslash characters in the graph encode functions
(elastic#196239)\n\n## Summary\r\n\r\nEscape backslash characters in the graph
encode
functions.","sha":"57c4b40270ff584ab8bc1859e1097ceb14171be0","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Graph","Team:Visualizations","release_note:skip","v9.0.0","backport:all-open"],"title":"[Graph]
Escape backslash characters in the graph encode
functions","number":196239,"url":"https://github.com/elastic/kibana/pull/196239","mergeCommit":{"message":"[Graph]
Escape backslash characters in the graph encode functions
(elastic#196239)\n\n## Summary\r\n\r\nEscape backslash characters in the graph
encode
functions.","sha":"57c4b40270ff584ab8bc1859e1097ceb14171be0"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/196239","number":196239,"mergeCommit":{"message":"[Graph]
Escape backslash characters in the graph encode functions
(elastic#196239)\n\n## Summary\r\n\r\nEscape backslash characters in the graph
encode functions.","sha":"57c4b40270ff584ab8bc1859e1097ceb14171be0"}}]}]
BACKPORT-->

Co-authored-by: Marta Bondyra <[email protected]>
  • Loading branch information
kibanamachine and mbondyra authored Oct 17, 2024
1 parent e1e7198 commit d068ea7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion x-pack/plugins/graph/public/helpers/kql_encoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import rison from '@kbn/rison';
import { Workspace } from '../types';

function escapeQuotes(str: string) {
return str.replace(/"/g, '\\"');
return str.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
}

export function asKQL(workspace: Workspace, joinBy: 'and' | 'or') {
Expand Down

0 comments on commit d068ea7

Please sign in to comment.