diff --git a/Classes/Utility/UrlUtility.php b/Classes/Utility/UrlUtility.php index 84c49352..cd0c9746 100644 --- a/Classes/Utility/UrlUtility.php +++ b/Classes/Utility/UrlUtility.php @@ -25,7 +25,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; use function array_merge; -use function count; use function rtrim; use function strpos; @@ -186,7 +185,9 @@ private function resolveWithVariants( array $variants = [], string $returnField = 'frontendBase' ): string { - if (count($variants) === 0) { + $frontendUrl = rtrim($frontendUrl, '/'); + + if ($variants === []) { return $frontendUrl; } diff --git a/Tests/Unit/Utility/UrlUtilityTest.php b/Tests/Unit/Utility/UrlUtilityTest.php index 6f6fcf54..4706e0d8 100644 --- a/Tests/Unit/Utility/UrlUtilityTest.php +++ b/Tests/Unit/Utility/UrlUtilityTest.php @@ -110,11 +110,11 @@ public function testFrontendUrlsWithBaseProductionAndLocalOverride(): void { $site = $this->prophesize(Site::class); $site->getConfiguration()->shouldBeCalled(3)->willReturn([ - 'base' => 'https://api.typo3.org', - 'frontendBase' => 'https://www.typo3.org', - 'frontendApiProxy' => 'https://www.typo3.org/headless', - 'frontendFileApi' => 'https://www.typo3.org/headless/fileadmin', - 'SpecialSitemapKey' => 'https://www.typo3.org/custom-sitemap', + 'base' => 'https://api.typo3.org/', + 'frontendBase' => 'https://www.typo3.org/', + 'frontendApiProxy' => 'https://www.typo3.org/headless/', + 'frontendFileApi' => 'https://www.typo3.org/headless/fileadmin/', + 'SpecialSitemapKey' => 'https://www.typo3.org/custom-sitemap/', 'languages' => [], 'baseVariants' => [ [ @@ -672,7 +672,7 @@ public function testEdgeCases() $urlUtility = new UrlUtility(null, $resolver->reveal(), $siteFinder, $request->reveal()); self::assertSame('https://frontend-domain-from-lang.tld', $urlUtility->getFrontendUrl()); - self::assertSame('https://frontend-domain-from-lang.tld/headless/', $urlUtility->getProxyUrl()); + self::assertSame('https://frontend-domain-from-lang.tld/headless', $urlUtility->getProxyUrl()); self::assertSame('https://frontend-domain-from-lang.tld/headless/fileadmin', $urlUtility->getStorageProxyUrl()); // configuration on language lvl with variants