From: Rico Hoppe Date: Tue, 7 May 2024 21:11:28 +0000 (+0000) Subject: wiki.py: make regex for user mentions only match the mention X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=04f3e83307b355462b13627853045b0172d2c6dc;p=ipfire.org.git wiki.py: make regex for user mentions only match the mention * fixes bug 13682 * the regex for user mentions used to match whitespace in front of the @ symbol. Through using \B it stops matching "any non word charakter" and only matches @'s after non-word boundaries. Signed-off-by: Rico Hoppe Signed-off-by: Michael Tremer --- diff --git a/src/backend/wiki.py b/src/backend/wiki.py index 706b1822..56d15cfd 100644 --- a/src/backend/wiki.py +++ b/src/backend/wiki.py @@ -995,7 +995,7 @@ class CVELinksPreprocessor(markdown.preprocessors.Preprocessor): class UserMentionPreprocessor(markdown.preprocessors.Preprocessor): - regex = re.compile(r"\W@(\w+)") + regex = re.compile(r"\B@(\w+)") def run(self, lines): for line in lines: