[icinga-checkins] icinga.org: icingaweb2/master: NavigationItemForm: Don't bypass Url' s own optimisations when saving urls

git at icinga.org git at icinga.org
Thu Nov 3 14:33:49 CET 2016


Module: icingaweb2
Branch: master
Commit: da2940a8110b5b2109777f94a79dd3656ed7e38d
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=da2940a8110b5b2109777f94a79dd3656ed7e38d

Author: Johannes Meyer <johannes.meyer at netways.de>
Date:   Thu Nov  3 14:31:47 2016 +0100

NavigationItemForm: Don't bypass Url's own optimisations when saving urls

refs #12133

---

 application/forms/Navigation/NavigationItemForm.php |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/application/forms/Navigation/NavigationItemForm.php b/application/forms/Navigation/NavigationItemForm.php
index 44f1648..1bd7eb9 100644
--- a/application/forms/Navigation/NavigationItemForm.php
+++ b/application/forms/Navigation/NavigationItemForm.php
@@ -99,8 +99,10 @@ class NavigationItemForm extends Form
         $values = parent::getValues($suppressArrayNotation);
         if (isset($values['url']) && $values['url']) {
             $url = Url::fromPath($values['url']);
-            if (! $url->isExternal() && ($relativePath = $url->getRelativeUrl())) {
-                $values['url'] = $relativePath;
+            if ($url->getBasePath() === $this->getRequest()->getBasePath()) {
+                $values['url'] = $url->getRelativeUrl();
+            } else {
+                $values['url'] = $url->getAbsoluteUrl();
             }
         }
 



More information about the icinga-checkins mailing list