diff --git a/system/src/Grav/Common/Uri.php b/system/src/Grav/Common/Uri.php index 374dccce27..2d4386017c 100644 --- a/system/src/Grav/Common/Uri.php +++ b/system/src/Grav/Common/Uri.php @@ -206,7 +206,7 @@ public function init() $uri = $language->setActiveFromUri($uri); // split the URL and params (and make sure that the path isn't seen as domain) - $bits = parse_url('http://domain.com' . $uri); + $bits = static::parseUrl('http://domain.com' . $uri); //process fragment if (isset($bits['fragment'])) { @@ -265,6 +265,7 @@ public function paths($id = null) return $this->paths; } + /** * Return route to the current URI. By default route doesn't include base path. * @@ -954,9 +955,7 @@ public static function parseUrl($url) $grav = Grav::instance(); // Remove extra slash from streams, parse_url() doesn't like it. - if ($pos = strpos($url, ':///')) { - $url = substr_replace($url, '://', $pos, 4); - } + $url = preg_replace('/([^:])(\/{2,})/', '$1/', $url); $encodedUrl = preg_replace_callback( '%[^:/@?&=#]+%usD',