Skip to content

Commit

Permalink
[BUGFIX] Don't render double slashes in file URLs
Browse files Browse the repository at this point in the history
Without a frontendApiProxy in the site config, URLs to local files contain two slashes like www.mysite.org//fileadmin/my-image.jpg
  • Loading branch information
kitzberger committed Nov 20, 2024
1 parent d7ebf57 commit b183c35
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Classes/XClass/ResourceLocalDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit b183c35

Please sign in to comment.