Skip to content

Commit

Permalink
Merge pull request #48 from sproutsocial/fix-re-injection
Browse files Browse the repository at this point in the history
Update views.py
  • Loading branch information
chasepd authored Aug 28, 2024
2 parents c04dc21 + 7175ba7 commit ffbd47d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions webapp/ui/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ def prepare_source_line(query_re, srcline, html=True):
def get_query_re(query, case_sensitive=True):
try:
if case_sensitive:
return re.compile(r'(' + query + r')')
return re.compile(r'(' + re.escape(query) + r')')
else:
return re.compile(r'(' + query + r')', flags=re.IGNORECASE)
return re.compile(r'(' + re.escape(query) + r')', flags=re.IGNORECASE)
except Exception as e:
raise RegexError(e)

Expand Down

0 comments on commit ffbd47d

Please sign in to comment.