Merge pull request #43251 from nextcloud/fix/support-external-urls-in-navigation

Allow application to pass external links in navigation
This commit is contained in:
Arthur Schiwon 2024-02-12 11:12:38 +01:00 committed by GitHub
commit e053ce243e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -115,7 +115,8 @@ class NavigationController extends OCSController {
*/
private function rewriteToAbsoluteUrls(array $navigation): array {
foreach ($navigation as &$entry) {
if (!str_starts_with($entry['href'], $this->urlGenerator->getBaseUrl())) {
/* 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())) {