Skip to content
This repository has been archived by the owner on Jun 30, 2020. It is now read-only.

Commit

Permalink
fixed saveResponse and readResponse with paths with unicode chars
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Mar 11, 2016
1 parent 858eabf commit fb6627b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/Utils/FileTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public function appendQuery($appendQuery = true)
*/
private function getFilename(RequestInterface $request, $indexExt = 'html')
{
$parts = pathinfo($request->getUri()->getPath());
$path = urldecode($request->getUri()->getPath());
$parts = pathinfo($path);
$path = isset($parts['dirname']) ? $parts['dirname'] : '';
$filename = isset($parts['basename']) ? $parts['basename'] : '';

Expand Down
14 changes: 11 additions & 3 deletions tests/SaveReadResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,23 @@ public function saveProvider()
'/hello-world',
'/hello-world/index.html',
'Hello world',
], [
],
[
'/post',
'/post/index.html',
'This is a post',
], [
],
[
'/Os miúdos camiños',
'/Os miúdos camiños/index.html',
'This is a post with spaces and tildes',
],
[
'/index.json',
'/index.json',
'{"hello": "world"}',
], [
],
[
'/',
'/index.html',
'Index',
Expand Down

0 comments on commit fb6627b

Please sign in to comment.