Fixed twig url() failing if stream has extra slash in it (e.g. user:///data)

This commit is contained in:
Matias Griese
2020-01-21 21:33:32 +02:00
parent e59f1e5a82
commit cac02663e6
2 changed files with 8 additions and 2 deletions

View File

@@ -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

View File

@@ -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;