Closed
Description
Describe the bug
cql2_like_to_es()
doesn't handle escaped backslashes, which leads to the following problems:
'\\'
(an escaped backslash) is not converted to'\'
.'\\%'
(an escaped backslash followed by a wildcard) is not converted to'\*'
'\\\%
(an escaped backslash followed by an escaped percent sign) is not converted to'\%'
.'\\_'
(an escaped backslash followed by a wildcard) is not converted to'\?'
.'\\\_'
(an escaped backslash followed by an escaped underscore) is not converted to'\_'
.
In addition, CQL2 doesn't appear to define what should happen when a trailing escape character is encountered (like 'abc\'
) nor what to do with an invalid escape sequence (like '\1'
).
I recommend rejecting invalid/incomplete escape sequences.
To Reproduce
I'll be posting a PR with a break/fix momentarily for evaluation.
Expected behavior
I expected cql2_like_to_es()
to understand escaped backslashes.
Screenshots
n/a
Desktop (please complete the following information):
n/a, this is a bug in the Python implementation
Smartphone (please complete the following information):
n/a
Additional context
n/a
Metadata
Metadata
Assignees
Labels
No labels