From e0ad957ac46228307c6969ffe2849f22e2f932b8 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 24 Aug 2021 23:15:20 +0200 Subject: [PATCH] Match mentions later because they are less specific Parts like `@example` can legitimately appears as part of a link that gets auto-detected. This issue was discovered when an URL was pasted that happens to also match a user that is named `document`. The "offending" URL was: `https://developer.mozilla.org/de/docs/Web/CSS/@document` The `@document` is recognized as part of a mention because the forward slash is a valid token that matches the boundary condition (`\b`) of the regex for mentions. See https://community.woltlab.com/thread/292020-automatische-link-umwandlung-schl%C3%A4gt-fehlt/ --- .../html/input/node/HtmlInputNodeTextParser.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php index 7c9366b4a8..d3a2605a0a 100644 --- a/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php +++ b/wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php @@ -199,10 +199,6 @@ class HtmlInputNodeTextParser $node = $nodes[$i]; $oldValue = $value = $node->textContent; - if (!empty($users) || !empty($groups)) { - $value = $this->parseMention($node, $value, $users, $groups); - } - if ($allowURL || $allowMedia) { $value = $this->parseURL($node, $value, $allowURL, $allowMedia); } @@ -215,6 +211,10 @@ class HtmlInputNodeTextParser $value = $this->parseSmiley($node, $value); } + if (!empty($users) || !empty($groups)) { + $value = $this->parseMention($node, $value, $users, $groups); + } + if ($value !== $oldValue) { $node->nodeValue = $value; } -- 2.20.1