diff options
| author | Markus Heiser <markus.heiser@darmarIT.de> | 2023-03-17 08:54:54 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-17 08:54:54 +0100 |
| commit | 677903c3557dda9fed3622b7727b8ede973abc29 (patch) | |
| tree | af06dbf199a87b048da36248e2284dc5506a4f4f | |
| parent | 0e1010988dc68addac9e2d87c11ea4599b559aa4 (diff) | |
| parent | fbb0e9d27509f30242c531c0d5e83c845f6a03eb (diff) | |
Merge pull request #2257 from Solirs/fix_bad_escape
re.escape() the query in highlight_content to prevent a server side error.
| -rw-r--r-- | searx/webutils.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/searx/webutils.py b/searx/webutils.py index 7b9a8045c..6c023ebc3 100644 --- a/searx/webutils.py +++ b/searx/webutils.py @@ -174,7 +174,9 @@ def highlight_content(content, query): queries.extend(re.findall(regex_highlight_cjk(qs), content, flags=re.I | re.U)) if len(queries) > 0: for q in set(queries): - content = re.sub(regex_highlight_cjk(q), f'<span class="highlight">{q}</span>', content) + content = re.sub( + regex_highlight_cjk(q), f'<span class="highlight">{q}</span>'.replace('\\', r'\\'), content + ) return content |