From 4cf140b5e5f20d384ff5ddea88eb030a791ca21c Mon Sep 17 00:00:00 2001 From: Côme Chilliet Date: Thu, 1 Feb 2024 14:29:51 +0100 Subject: fix: Support other schemes than HTTP and HTTPS in app navigation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- core/Controller/NavigationController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'core/Controller') diff --git a/core/Controller/NavigationController.php b/core/Controller/NavigationController.php index 2432df937ce..0996b41042e 100644 --- a/core/Controller/NavigationController.php +++ b/core/Controller/NavigationController.php @@ -115,7 +115,8 @@ class NavigationController extends OCSController { */ private function rewriteToAbsoluteUrls(array $navigation): array { foreach ($navigation as &$entry) { - if (!str_starts_with($entry['href'], 'https://') && !str_starts_with($entry['href'], 'http://')) { + /* If parse_url finds no host it means the URL is not absolute */ + if (!isset(\parse_url($entry['href'])['host'])) { $entry['href'] = $this->urlGenerator->getAbsoluteURL($entry['href']); } if (!str_starts_with($entry['icon'], $this->urlGenerator->getBaseUrl())) { -- cgit v1.2.3