From e3d3eeaf2011c13fcdfd960a904e365f6c79b1b3 Mon Sep 17 00:00:00 2001 From: Yoonchae Lee Date: Mon, 9 Oct 2023 12:32:59 +0900 Subject: [PATCH] escape field name when using it in regex --- src/addon/configwindow.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/addon/configwindow.py b/src/addon/configwindow.py index 073e937..29071eb 100644 --- a/src/addon/configwindow.py +++ b/src/addon/configwindow.py @@ -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], )