From eef4322188846d8e5b8c02a0e5d49d719f94c9d7 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Wed, 30 Sep 2015 15:36:45 +0200 Subject: [PATCH] Url: Fix automatic stripping of the current base url in method fromPath() --- library/Icinga/Web/Url.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/library/Icinga/Web/Url.php b/library/Icinga/Web/Url.php index cddfb5721..2c4991e71 100644 --- a/library/Icinga/Web/Url.php +++ b/library/Icinga/Web/Url.php @@ -161,16 +161,15 @@ class Url if ($urlPath && $urlPath[0] === '/') { if ($baseUrl) { $urlPath = substr($urlPath, 1); + } elseif (strpos($urlPath, $request->getBaseUrl()) === 0) { + $baseUrl = $request->getBaseUrl(); + $urlPath = substr($urlPath, strlen($baseUrl) + 1); } } elseif (! $baseUrl) { $baseUrl = $request->getBaseUrl(); } - if ($baseUrl && !$urlObject->isExternal() && strpos($urlPath, $baseUrl) === 0) { - $urlObject->setPath(substr($urlPath, strlen($baseUrl))); - } else { - $urlObject->setPath($urlPath); - } + $urlObject->setPath($urlPath); } elseif (! $baseUrl) { $baseUrl = $request->getBaseUrl(); }