From: Marcel Werk Date: Mon, 13 Nov 2017 12:06:13 +0000 (+0100) Subject: getRegexFromLink no longer matches links to anchors (e.g. comments/responses) X-Git-Tag: 3.1.0_Beta_3~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e6182b81b49cb3bbe41a976d55ff870de0260d7e;p=GitHub%2FWoltLab%2FWCF.git getRegexFromLink no longer matches links to anchors (e.g. comments/responses) --- diff --git a/wcfsetup/install/files/lib/system/event/listener/AbstractHtmlInputNodeProcessorListener.class.php b/wcfsetup/install/files/lib/system/event/listener/AbstractHtmlInputNodeProcessorListener.class.php index 162ac26d90..b23243851c 100644 --- a/wcfsetup/install/files/lib/system/event/listener/AbstractHtmlInputNodeProcessorListener.class.php +++ b/wcfsetup/install/files/lib/system/event/listener/AbstractHtmlInputNodeProcessorListener.class.php @@ -46,10 +46,11 @@ abstract class AbstractHtmlInputNodeProcessorListener implements IParameterizedE * followed by an object id. * * @param string $link + * @param string $defaultAnchor * @return Regex */ - protected function getRegexFromLink($link) { - return new Regex('^(' . preg_replace('~^https?~', 'https?', preg_quote($link)) . '(\d+)-.*?)$'); + protected function getRegexFromLink($link, $defaultAnchor = '') { + return new Regex('^(' . preg_replace('~^https?~', 'https?', preg_quote($link)) . '(\d+)-[^#]*?)' . ($defaultAnchor ? '(?:#' . $defaultAnchor . ')?' : '') . '$'); } /**