From 4fb5c15db586e1b59e708d313211d3e012a42f7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Thu, 1 Feb 2024 09:52:37 +0100 Subject: [PATCH] Allow application to pass external links in 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/Controller/NavigationController.php b/core/Controller/NavigationController.php index db1d67cc778..61f8fe1d5e7 100644 --- a/core/Controller/NavigationController.php +++ b/core/Controller/NavigationController.php @@ -115,10 +115,10 @@ class NavigationController extends OCSController { */ private function rewriteToAbsoluteUrls(array $navigation): array { foreach ($navigation as &$entry) { - if (!str_starts_with($entry['href'], $this->urlGenerator->getBaseUrl())) { + if (!str_starts_with($entry['href'], 'https://') && !str_starts_with($entry['href'], 'http://')) { $entry['href'] = $this->urlGenerator->getAbsoluteURL($entry['href']); } - if (!str_starts_with($entry['icon'], $this->urlGenerator->getBaseUrl())) { + if (!str_starts_with($entry['icon'], 'https://') && !str_starts_with($entry['icon'], 'http://')) { $entry['icon'] = $this->urlGenerator->getAbsoluteURL($entry['icon']); } }