]> git.ipfire.org Git - ipfire.org.git/commitdiff
wiki.py: make regex for user mentions only match the mention
authorRico Hoppe <rico.hoppe@ipfire.org>
Tue, 7 May 2024 21:11:28 +0000 (21:11 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 10 May 2024 12:17:02 +0000 (12:17 +0000)
* 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 <rico.hoppe@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/backend/wiki.py

index 706b18229e1209315c112b6591a45e01ad0eb278..56d15cfd5115595172ff8aadd418312af9eb1baa 100644 (file)
@@ -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: