From b183c3531d72e6836953540349d9af918e49192b Mon Sep 17 00:00:00 2001 From: Philipp Kitzberger Date: Wed, 20 Nov 2024 11:32:44 +0100 Subject: [PATCH] [BUGFIX] Don't render double slashes in file URLs Without a frontendApiProxy in the site config, URLs to local files contain two slashes like www.mysite.org//fileadmin/my-image.jpg --- Classes/XClass/ResourceLocalDriver.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Classes/XClass/ResourceLocalDriver.php b/Classes/XClass/ResourceLocalDriver.php index 18b4ace1..5caf183b 100644 --- a/Classes/XClass/ResourceLocalDriver.php +++ b/Classes/XClass/ResourceLocalDriver.php @@ -53,10 +53,12 @@ protected function determineBaseUrl(): void }; if ($basePath !== '') { - $frontendUri = (new Uri($urlUtility->getFrontendUrl())); + $frontendUri = new Uri($urlUtility->getFrontendUrl()); + $proxyUri = new Uri($urlUtility->getProxyUrl()); + $baseUri = new Uri($basePath); - $path = new Uri(trim($basePath, '/')); - $this->configuration['baseUri'] = (string)$frontendUri->withPath('/' . trim((new Uri($urlUtility->getProxyUrl()))->getPath(), '/') . '/' . trim($path->getPath(), '/')); + $path = trim($proxyUri->getPath(), '/') . '/' . trim($baseUri->getPath(), '/'); + $this->configuration['baseUri'] = (string)$frontendUri->withPath('/' . trim($path, '/')); } else { $this->configuration['baseUri'] = $urlUtility->getStorageProxyUrl(); }