Skip to content

Commit

Permalink
escape field name when using it in regex
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueGreenMagick committed Oct 9, 2023
1 parent 7ff6dd2 commit e3d3eea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/addon/configwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,13 @@ def modify_field_editability(
for side in ["qfmt", "afmt"]:
if field["edit"] == Editability.ALL:
template[side] = re.sub(
"{{((?:(?!edit:)[^#/:}]+:)*%s)}}" % field["name"],
"{{((?:(?!edit:)[^#/:}]+:)*%s)}}" % re.escape(field["name"]),
r"{{edit:\1}}",
template[side],
)
elif field["edit"] == Editability.NONE:
template[side] = re.sub(
"{{((?:[^#/:}]+:)*)edit:((?:[^#/:}]+:)*%s)}}" % field["name"],
"{{((?:[^#/:}]+:)*)edit:((?:[^#/:}]+:)*%s)}}" % re.escape(field["name"]),
r"{{\1\2}}",
template[side],
)
Expand Down

0 comments on commit e3d3eea

Please sign in to comment.