Url: Build full urlString instead of path if username is set

refs #12133
This commit is contained in:
Noah Hilverling 2016-10-18 16:19:24 +02:00
parent a952a400ca
commit 3b6b0b8d4b

View File

@ -589,25 +589,28 @@ class Url
if (! $basePath) {
$basePath = '/';
}
if (!$this->isExternal()) {
return $basePath . ($basePath !== '/' && $path ? '/' : '') . $path;
}
if ($this->getUsername() || $this->isExternal()) {
$urlString = '';
if ($this->getScheme()) {
$urlString = $urlString . $this->getScheme() . '://';
$urlString .= $this->getScheme() . '://';
}
if ($this->getUsername() && $this->getPassword()) {
$urlString = $urlString . $this->getUsername() . ':' . $this->getPassword() . "@";
if ($this->getPassword()) {
$urlString .= $this->getUsername() . ':' . $this->getPassword() . '@';
} elseif ($this->getUsername()) {
$urlString .= $this->getUsername() . '@';
}
if ($this->getHost()) {
$urlString = $urlString . $this->getHost();
$urlString .= $this->getHost();
}
if ($this->getPort()) {
$urlString = $urlString . $this->getPort();
$urlString .= ':' . $this->getPort();
}
return $urlString . '/' . $path;
} else {
return $basePath . ($basePath !== '/' && $path ? '/' : '') . $path;
}
}
/**