Fix for custom_base_url not routing properly

This commit is contained in:
Andy Miller
2018-04-17 19:04:16 -06:00
parent 33cfa17899
commit ac8a1191f8

View File

@@ -133,7 +133,12 @@ class Uri
$custom_parts = parse_url($custom_base);
$orig_root_path = $this->root_path;
$this->root_path = isset($custom_parts['path']) ? rtrim($custom_parts['path'], '/') : '';
$this->root = isset($custom_parts['scheme']) ? $custom_base : $this->base . $this->root_path;
if (isset($custom_parts['scheme'])) {
$this->base = $custom_parts['scheme'] . '://' . $custom_parts['host'];
$this->root = $custom_base;
} else {
$this->root = $this->base . $this->root_path;
}
$this->uri = Utils::replaceFirstOccurrence($orig_root_path, $this->root_path, $this->uri);
} else {
$this->root = $this->base . $this->root_path;
@@ -143,6 +148,7 @@ class Uri
$uri = str_replace(static::filterPath($this->root), '', $this->url);
// remove the setup.php based base if set:
$setup_base = $grav['pages']->base();
if ($setup_base) {
@@ -1185,7 +1191,6 @@ class Uri
if ($this->host) {
$this->host = $this->validateHostname($this->host) ? $this->host : 'unknown';
}
// Filter userinfo, path, query string and fragment.
$this->user = $this->user !== null ? static::filterUserInfo($this->user) : null;
$this->password = $this->password !== null ? static::filterUserInfo($this->password) : null;