Skip to content

Commit

Permalink
[8.x] [Lens] escape backslash characters in the formula input (#196171)…
Browse files Browse the repository at this point in the history
… (#196237)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Lens] escape backslash characters in the formula input
(#196171)](#196171)

<!--- 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-15T07:46:56Z","message":"[Lens]
escape backslash characters in the formula input (#196171)\n\n##
Summary\r\n\r\nEnsures that backslashes are properly escaped in addition
to single\r\nquotes in
formula","sha":"e0251df6bd944fc53c58b9ee73c0b5d2eb892197","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Visualizations","release_note:skip","Feature:Lens","v9.0.0","backport:prev-minor"],"title":"[Lens]
escape backslash characters in the formula
input","number":196171,"url":"https://github.com/elastic/kibana/pull/196171","mergeCommit":{"message":"[Lens]
escape backslash characters in the formula input (#196171)\n\n##
Summary\r\n\r\nEnsures that backslashes are properly escaped in addition
to single\r\nquotes in
formula","sha":"e0251df6bd944fc53c58b9ee73c0b5d2eb892197"}},"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/196171","number":196171,"mergeCommit":{"message":"[Lens]
escape backslash characters in the formula input (#196171)\n\n##
Summary\r\n\r\nEnsures that backslashes are properly escaped in addition
to single\r\nquotes in
formula","sha":"e0251df6bd944fc53c58b9ee73c0b5d2eb892197"}}]}]
BACKPORT-->

Co-authored-by: Marta Bondyra <[email protected]>
  • Loading branch information
kibanamachine and mbondyra authored Oct 15, 2024
1 parent d7ee2da commit 7245dc5
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export function generateFormula(
}
previousFormula +=
(previousColumn.filter.language === 'kuery' ? 'kql=' : 'lucene=') +
`'${previousColumn.filter.query.replace(/'/g, `\\'`)}'`; // replace all
`'${previousColumn.filter.query.replace(/\\/g, '\\\\').replace(/'/g, `\\'`)}'`; // replace all
}
if (previousColumn.timeShift) {
if (
Expand Down

0 comments on commit 7245dc5

Please sign in to comment.