Skip to content

Commit eaf2010

Browse files
authored
[BUGFIX] Don't render double slashes in file URLs (#796)
Without a frontendApiProxy in the site config, URLs to local files contain two slashes like www.mysite.org//fileadmin/my-image.jpg
1 parent d7ebf57 commit eaf2010

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Classes/XClass/ResourceLocalDriver.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@ protected function determineBaseUrl(): void
5353
};
5454

5555
if ($basePath !== '') {
56-
$frontendUri = (new Uri($urlUtility->getFrontendUrl()));
56+
$frontendUri = new Uri($urlUtility->getFrontendUrl());
57+
$proxyUri = new Uri($urlUtility->getProxyUrl());
58+
$baseUri = new Uri($basePath);
5759

58-
$path = new Uri(trim($basePath, '/'));
59-
$this->configuration['baseUri'] = (string)$frontendUri->withPath('/' . trim((new Uri($urlUtility->getProxyUrl()))->getPath(), '/') . '/' . trim($path->getPath(), '/'));
60+
$path = trim($proxyUri->getPath(), '/') . '/' . trim($baseUri->getPath(), '/');
61+
$this->configuration['baseUri'] = (string)$frontendUri->withPath('/' . trim($path, '/'));
6062
} else {
6163
$this->configuration['baseUri'] = $urlUtility->getStorageProxyUrl();
6264
}

0 commit comments

Comments
 (0)