Url: Build full urlString instead of path if username is set
refs #12133
This commit is contained in:
parent
a952a400ca
commit
3b6b0b8d4b
|
@ -586,28 +586,31 @@ class Url
|
||||||
}
|
}
|
||||||
|
|
||||||
$basePath = $this->getBasePath();
|
$basePath = $this->getBasePath();
|
||||||
if (!$basePath) {
|
if (! $basePath) {
|
||||||
$basePath = '/';
|
$basePath = '/';
|
||||||
}
|
}
|
||||||
if (!$this->isExternal()) {
|
|
||||||
|
if ($this->getUsername() || $this->isExternal()) {
|
||||||
|
$urlString = '';
|
||||||
|
if ($this->getScheme()) {
|
||||||
|
$urlString .= $this->getScheme() . '://';
|
||||||
|
}
|
||||||
|
if ($this->getPassword()) {
|
||||||
|
$urlString .= $this->getUsername() . ':' . $this->getPassword() . '@';
|
||||||
|
} elseif ($this->getUsername()) {
|
||||||
|
$urlString .= $this->getUsername() . '@';
|
||||||
|
}
|
||||||
|
if ($this->getHost()) {
|
||||||
|
$urlString .= $this->getHost();
|
||||||
|
}
|
||||||
|
if ($this->getPort()) {
|
||||||
|
$urlString .= ':' . $this->getPort();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $urlString . '/' . $path;
|
||||||
|
} else {
|
||||||
return $basePath . ($basePath !== '/' && $path ? '/' : '') . $path;
|
return $basePath . ($basePath !== '/' && $path ? '/' : '') . $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
$urlString = '';
|
|
||||||
if ($this->getScheme()) {
|
|
||||||
$urlString = $urlString . $this->getScheme() . '://';
|
|
||||||
}
|
|
||||||
if ($this->getUsername() && $this->getPassword()) {
|
|
||||||
$urlString = $urlString . $this->getUsername() . ':' . $this->getPassword() . "@";
|
|
||||||
}
|
|
||||||
if ($this->getHost()) {
|
|
||||||
$urlString = $urlString . $this->getHost();
|
|
||||||
}
|
|
||||||
if ($this->getPort()) {
|
|
||||||
$urlString = $urlString . $this->getPort();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $urlString . '/' . $path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue