From 072d4bb0d08627ff31f176fc8318fe2a12ef24a3 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 eb9ef4e52b462..dce5f927e60c0 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;