Skip to content

Commit

Permalink
Merge pull request #1 from dwnload/develop
Browse files Browse the repository at this point in the history
Version 1.0.4
  • Loading branch information
thefrosty committed Apr 19, 2018
2 parents f26fe99 + b5874b1 commit 41caccd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
10 changes: 10 additions & 0 deletions CHANGELONG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## 1.0.4 - 2018-04-19
### Updated
- `RestDispatch::preDispatch` should set the $request_uri from `CacheApiTrait::getRequestUri` and not use
`WP_REST_Request::get_route` to avoid query parameters getting stripped out of the cache request.
- `CacheApiTrait::getRequestUri` to sanitize the REQUEST_URI

## 1.0.3 - 2018-04-18
### Updated
- Bumped [thefrosty/wp-utilities](https://github.com/thefrosty/wp-utilities/) to version 1.1.3

## 1.0.2 - 2018-04-18
### Updated
- Bumped [thefrosty/wp-utilities](https://github.com/thefrosty/wp-utilities/) to version 1.1.2
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "dwnload/wp-rest-api-object-cache",
"description": "Enable object caching for WordPress' REST API. Aids in increased response times of your applications endpoints.",
"type": "wordpress-plugin",
"version": "1.0.3",
"version": "1.0.4",
"license": "MIT",
"authors": [
{
Expand Down
5 changes: 2 additions & 3 deletions src/RestApi/CacheApiTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,10 @@ protected function wpCacheDeleteByKey(string $key) : bool
* Return the current REQUEST_URI from the global server variable.
* Don't use `FILTER_SANITIZE_URL` since it will return false when 'http' isn't present.
*
* @param string|null $route The request route.
* @return string
*/
protected function getRequestUri(string $route = null) : string
protected function getRequestUri() : string
{
return filter_var_string($route ?? $_SERVER['REQUEST_URI']);
return filter_var_string(wp_unslash($_SERVER['REQUEST_URI']));
}
}
2 changes: 1 addition & 1 deletion src/RestApi/RestDispatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function addHooks()
*/
public function preDispatch($result, WP_REST_Server $server, WP_REST_Request $request)
{
$request_uri = $request->get_route() ?? $this->getRequestUri();
$request_uri = $this->getRequestUri();
$group = $this->getCacheGroup();
$key = $this->getCacheKey($request_uri, $server, $request);

Expand Down

0 comments on commit 41caccd

Please sign in to comment.