Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fbb0e9d2 authored by Solirs's avatar Solirs Committed by Markus Heiser
Browse files

[fix] server side error: escape backslashes in the query highlight_content

parent 3e9cddc6
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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