From 33685c58de32ddf5e33c4ee0d4dedcb1fd44051b Mon Sep 17 00:00:00 2001 From: Louis Chemineau Date: Wed, 29 Sep 2021 16:07:08 +0200 Subject: [PATCH] Prevent empty base URL during installation Signed-off-by: Louis Chemineau --- lib/private/URLGenerator.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/private/URLGenerator.php b/lib/private/URLGenerator.php index f7fa6fa56322a..511c37d26240a 100644 --- a/lib/private/URLGenerator.php +++ b/lib/private/URLGenerator.php @@ -271,7 +271,8 @@ public function linkToDocs(string $key): string { * @return string base url of the current request */ public function getBaseUrl(): string { - if ($this->baseUrl === null) { + // BaseUrl can be equal to 'http(s)://' during the first steps of the intial setup. + if ($this->baseUrl === null || $this->baseUrl === "http://" || $this->baseUrl === "https://") { $this->baseUrl = $this->request->getServerProtocol() . '://' . $this->request->getServerHost() . \OC::$WEBROOT; } return $this->baseUrl;