From 72f3a01abfca5fe11bdd46d0af0c8019f33dfdeb Mon Sep 17 00:00:00 2001 From: Wensheng Yan Date: Wed, 15 Nov 2017 20:35:44 -0500 Subject: [PATCH 1/2] Update Cache.php (#1745) make sure find resource return valid path. --- system/src/Grav/Common/Cache.php | 1 + 1 file changed, 1 insertion(+) 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 . '/*'); From cb4147a4bd3572945608d01abb93dfc8f836b6d5 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Fri, 17 Nov 2017 08:03:58 +0200 Subject: [PATCH 2/2] Fixed token creation issue with `Uri` params like `/id:3` --- CHANGELOG.md | 2 ++ system/src/Grav/Common/Uri.php | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 409f6018a..fe3cd89c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,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/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); }