From: Tim Düsterhus Date: Wed, 6 Sep 2023 14:30:33 +0000 (+0200) Subject: Ensure the URL's authority is fully visible when truncating link values X-Git-Tag: 6.0.0_RC_1~61^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=89e12f48fb327f0bca6413cba89a3ccdc6a7f263;p=GitHub%2FWoltLab%2FWCF.git Ensure the URL's authority is fully visible when truncating link values --- diff --git a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeA.class.php b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeA.class.php index 04893e63c8..d730db850a 100644 --- a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeA.class.php +++ b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeA.class.php @@ -54,8 +54,26 @@ class HtmlOutputNodeA extends AbstractHtmlOutputNode } $newValue = $value; - if (\mb_strlen($value) > 60) { - $newValue = \mb_substr($value, 0, 30) . StringUtil::HELLIP . \mb_substr($value, -25); + if (\mb_strlen($newValue) > 60) { + $uri = new Uri($newValue); + $schemeHost = Uri::composeComponents( + $uri->getScheme(), + $uri->getAuthority(), + '', + null, + null, + ); + $pathQueryFragment = Uri::composeComponents( + null, + null, + $uri->getPath(), + $uri->getQuery(), + $uri->getFragment(), + ); + if (\mb_strlen($pathQueryFragment) > 35) { + $pathQueryFragment = \mb_substr($pathQueryFragment, 0, 15) . StringUtil::HELLIP . \mb_substr($pathQueryFragment, -15); + } + $newValue = $schemeHost . $pathQueryFragment; } $element->appendChild(