Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

models: Update `group_match_regex` to correctly detect parameters in `url_format_string`.

akshatdalton0da00018adba
diff --git a/zerver/models.py b/zerver/models.py
index 6b821924e0a..0ac503d1e41 100644
--- a/zerver/models.py
+++ b/zerver/models.py
@@ -973,7 +973,7 @@ class RealmFilter(models.Model):
# this regex will incorrectly reject patterns that attempt to
# escape % using %%.
found_group_set: Set[str] = set()
- group_match_regex = r"%\((?P<group_name>[^()]+)\)s"
+ group_match_regex = r"(?<!%)%\((?P<group_name>[^()]+)\)s"
for m in re.finditer(group_match_regex, self.url_format_string):
group_name = m.group("group_name")
found_group_set.add(group_name)