search: escape apostrophes.

pull/2/head
Snakes 2022-11-18 16:55:15 -05:00
parent 7fe499ce41
commit 38ac92b4aa
Signed by: Snakes
GPG Key ID: E745A82778055C7E
1 changed files with 1 additions and 0 deletions

View File

@ -216,6 +216,7 @@ def searchcomments(v):
if 'q' in criteria:
tokens = map(lambda x: re.sub(r'[\0():|&*!<>]', '', x), criteria['q'])
tokens = filter(lambda x: len(x) > 0, tokens)
tokens = map(lambda x: re.sub(r"'", "\\'", x), tokens)
tokens = map(lambda x: re.sub(r'\s+', ' <-> ', x), tokens)
comments = comments.filter(Comment.body_ts.match(
' & '.join(tokens),