mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-26 23:34:08 +02:00
Url: Do not throw ProgrammingError if there is no relative url available
refs #5600
This commit is contained in:
parent
338c0680e0
commit
165dc00fad
@ -282,19 +282,15 @@ class Url
|
|||||||
* Return the relative url
|
* Return the relative url
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*
|
|
||||||
* @throws ProgrammingError In case no relative url path is set or it is absolute
|
|
||||||
*/
|
*/
|
||||||
public function getRelativeUrl($separator = '&')
|
public function getRelativeUrl($separator = '&')
|
||||||
{
|
{
|
||||||
$path = $this->getPath();
|
$path = $this->buildPathQueryAndFragment($separator);
|
||||||
if (! $path) {
|
if ($path && $path[0] === '/') {
|
||||||
throw new ProgrammingError('Unable to provide a relative URL. No path set');
|
return '';
|
||||||
} elseif ($path[0] === '/') {
|
|
||||||
throw new ProgrammingError('Cannot provide a relative URL. Path is absolute');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->buildPathQueryAndFragment($separator);
|
return $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user