mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-16 12:12:53 -06:00
Add re.escape to highlight_string
This commit is contained in:
parent
9e09e46700
commit
df5febf6e7
@ -517,7 +517,7 @@ def highlight_string(value, highlight, trim_pre=None, trim_post=None, trim_place
|
||||
"""
|
||||
# Split value on highlight string
|
||||
try:
|
||||
pre, match, post = re.split(fr'({highlight})', value, maxsplit=1, flags=re.IGNORECASE)
|
||||
pre, match, post = re.split(fr'({re.escape(highlight)})', value, maxsplit=1, flags=re.IGNORECASE)
|
||||
except ValueError:
|
||||
# Match not found
|
||||
return escape(value)
|
||||
|
Loading…
Reference in New Issue
Block a user