Allow application to pass external links in navigation

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/43251/head
Côme Chilliet 4 months ago committed by Côme Chilliet
parent 5238b1c64c
commit 4fb5c15db5

@ -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']);
}
}

Loading…
Cancel
Save