Url: Fix path handling for internal urls

refs #12133
This commit is contained in:
Noah Hilverling 2016-10-14 15:05:16 +02:00
parent ef359aa686
commit 9439dfa8f3
1 changed files with 7 additions and 1 deletions

View File

@ -191,6 +191,8 @@ class Url
|| (isset($urlParts['port']) && $urlParts['port'] != $request->getServer('SERVER_PORT'))) || (isset($urlParts['port']) && $urlParts['port'] != $request->getServer('SERVER_PORT')))
) { ) {
$urlObject->setIsExternal(); $urlObject->setIsExternal();
} else {
$urlObject->setBasePath($request->getBaseUrl());
} }
if (isset($urlParts['path'])) { if (isset($urlParts['path'])) {
@ -558,8 +560,12 @@ class Url
return $path; return $path;
} }
$basePath = $this->getBasePath();
if (!$basePath) {
$basePath = '/';
}
if (!$this->isExternal()) { if (!$this->isExternal()) {
return '/icingaweb2/' . $path; return $basePath . ($basePath !== '/' && $path ? '/' : '') . $path;
} }
$urlString = ''; $urlString = '';