From da2940a8110b5b2109777f94a79dd3656ed7e38d Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 3 Nov 2016 14:31:47 +0100 Subject: [PATCH] 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 44f16488c..1bd7eb97f 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(); } }