Skip to content

Commit df5febf

Browse files
kkthxbye-codejeremystretch
authored andcommitted
Add re.escape to highlight_string
1 parent 9e09e46 commit df5febf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

netbox/utilities/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ def highlight_string(value, highlight, trim_pre=None, trim_post=None, trim_place
517517
"""
518518
# Split value on highlight string
519519
try:
520-
pre, match, post = re.split(fr'({highlight})', value, maxsplit=1, flags=re.IGNORECASE)
520+
pre, match, post = re.split(fr'({re.escape(highlight)})', value, maxsplit=1, flags=re.IGNORECASE)
521521
except ValueError:
522522
# Match not found
523523
return escape(value)

0 commit comments

Comments
 (0)