From a1a00685df6f05e20b20dc45ac0137801f75e088 Mon Sep 17 00:00:00 2001 From: Philipp Kitzberger Date: Fri, 31 Jul 2026 13:04:02 +0200 Subject: [PATCH] [BUGFIX] Absolute URL with section anchor accidentially turned to relative URL Resolves: #908 --- Classes/Utility/UrlUtility.php | 5 ----- Tests/Unit/Utility/UrlUtilityTest.php | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Classes/Utility/UrlUtility.php b/Classes/Utility/UrlUtility.php index 5a9af18d..8bb30a2f 100644 --- a/Classes/Utility/UrlUtility.php +++ b/Classes/Utility/UrlUtility.php @@ -120,11 +120,6 @@ public function getFrontendUrlWithSite($url, SiteInterface $site, string $return $targetUri = $targetUri->withScheme($frontendBase->getScheme()); } - if ($targetUri->getFragment() !== '') { - $targetUri = $targetUri->withHost(''); - $targetUri = $targetUri->withScheme(''); - } - if ($frontExtraPath) { $targetUri = $targetUri->withPath($this->handleFrontendAndBackendPaths($frontExtraPath, $targetUri, $site->getBase()->getPath())); } diff --git a/Tests/Unit/Utility/UrlUtilityTest.php b/Tests/Unit/Utility/UrlUtilityTest.php index 9800cabd..7177293a 100644 --- a/Tests/Unit/Utility/UrlUtilityTest.php +++ b/Tests/Unit/Utility/UrlUtilityTest.php @@ -133,6 +133,7 @@ public function testFrontendUrls(): void self::assertSame('https://test-frontend3.tld/sitemap', $urlUtility->resolveKey('SpecialSitemapKey')); self::assertSame('https://test-frontend-api3.tld/headless', $urlUtility->getFrontendUrlWithSite('https://test-backend3-api.tld', $site->reveal(), 'frontendApiProxy')); self::assertSame('#fragment-123', $urlUtility->getFrontendUrlWithSite('#fragment-123', $site->reveal())); + self::assertSame('https://test-frontend3.tld/test-page#section', $urlUtility->getFrontendUrlWithSite('https://test-backend-api.tld/test-page#section', $site->reveal())); } public function testFrontendUrlsWithDifferentPaths(): void