diff --git a/CHANGELOG.md b/CHANGELOG.md index d40908d92..6dc9f70db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ * Fixed `ignore_empty: true` not removing empty values in blueprint filtering * Fixed `{{ false|string }}` twig to return '0' instead of '' * Fixed `Data::filter()` removing empty fields (such as empty list) by default + * Fixed twig `url()` failing if stream has extra slash in it (e.g. `user:///data`) * Grav 1.7: Fixed `Flex Pages` unserialize issues if Flex-Objects Plugin has not been installed * Grav 1.7: Require Flex-Objects Plugin to edit Flex Accounts diff --git a/system/src/Grav/Common/Uri.php b/system/src/Grav/Common/Uri.php index 60ed4e940..10fbb0ee7 100644 --- a/system/src/Grav/Common/Uri.php +++ b/system/src/Grav/Common/Uri.php @@ -918,9 +918,14 @@ class Uri { $grav = Grav::instance(); + // Remove extra slash from streams, parse_url() doesn't like it. + if ($pos = strpos($url, ':///')) { + $url = substr_replace($url, '://', $pos, 4); + } + $encodedUrl = preg_replace_callback( '%[^:/@?&=#]+%usD', - function ($matches) { + static function ($matches) { return rawurlencode($matches[0]); }, $url @@ -940,7 +945,7 @@ class Uri $parts['path'] = ''; } - list($stripped_path, $params) = static::extractParams($parts['path'], $grav['config']->get('system.param_sep')); + [$stripped_path, $params] = static::extractParams($parts['path'], $grav['config']->get('system.param_sep')); if (!empty($params)) { $parts['path'] = $stripped_path;