[icinga-checkins] icinga.org: icingaweb2/bugfix/ username-and-password-not-being-passed-in-navigation-item-urls-12133: Url: Fix path handling for internal urls

git at icinga.org git at icinga.org
Fri Oct 14 15:06:02 CEST 2016


Module: icingaweb2
Branch: bugfix/username-and-password-not-being-passed-in-navigation-item-urls-12133
Commit: 9439dfa8f3109ba40d740c4d9810ffdcf11b3f1c
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=9439dfa8f3109ba40d740c4d9810ffdcf11b3f1c

Author: Noah Hilverling <noah.hilverling at netways.de>
Date:   Fri Oct 14 15:05:16 2016 +0200

Url: Fix path handling for internal urls

refs #12133

---

 library/Icinga/Web/Url.php |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/library/Icinga/Web/Url.php b/library/Icinga/Web/Url.php
index 548de43..3b25d77 100644
--- a/library/Icinga/Web/Url.php
+++ b/library/Icinga/Web/Url.php
@@ -191,6 +191,8 @@ class Url
             || (isset($urlParts['port']) && $urlParts['port'] != $request->getServer('SERVER_PORT')))
         ) {
             $urlObject->setIsExternal();
+        } else {
+            $urlObject->setBasePath($request->getBaseUrl());
         }
 
         if (isset($urlParts['path'])) {
@@ -558,8 +560,12 @@ class Url
             return $path;
         }
 
+        $basePath = $this->getBasePath();
+        if (!$basePath) {
+           $basePath = '/';
+        }
         if (!$this->isExternal()) {
-            return '/icingaweb2/' . $path;
+            return $basePath . ($basePath !== '/' && $path ? '/' : '') . $path;
         }
 
         $urlString = '';



More information about the icinga-checkins mailing list