diff --git a/CHANGELOG.md b/CHANGELOG.md index 81712e815..58693585a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,8 @@ * Uri: Encode user and password to prevent issues in browsers * Fixed "Invalid AJAX response" When using Built-in PHP Webserver in Windows [#1258](https://github.com/getgrav/grav-plugin-admin/issues/1258) * Remove support for `config.user`, it was broken and bad practise + * Make sure that `clean cache` uses valid path [#1745](https://github.com/getgrav/grav/pull/1745) + * Fixed token creation issue with `Uri` params like `/id:3` # v1.3.8 ## 10/26/2017 diff --git a/system/src/Grav/Common/Cache.php b/system/src/Grav/Common/Cache.php index 254f6fdd0..8e9ed3977 100644 --- a/system/src/Grav/Common/Cache.php +++ b/system/src/Grav/Common/Cache.php @@ -390,6 +390,7 @@ class Cache extends Getters // Convert stream to a real path try { $path = $locator->findResource($stream, true, true); + if($path === false) continue; $anything = false; $files = glob($path . '/*'); diff --git a/system/src/Grav/Common/Uri.php b/system/src/Grav/Common/Uri.php index 0f9b4593e..10acb28cd 100644 --- a/system/src/Grav/Common/Uri.php +++ b/system/src/Grav/Common/Uri.php @@ -1143,11 +1143,20 @@ class Uri */ public static function addNonce($url, $action, $nonceParamName = 'nonce') { + $fake = $url && $url[0] === '/'; + + if ($fake) { + $url = 'http://domain.com' . $url; + } $uri = new static($url); $parts = $uri->toArray(); $nonce = Utils::getNonce($action); $parts['params'] = (isset($parts['params']) ? $parts['params'] : []) + [$nonceParamName => $nonce]; + if ($fake) { + unset($parts['scheme'], $parts['host']); + } + return static::buildUrl($parts); }