Skip to content

Commit

Permalink
Merge pull request #467 from enov/refix/4079/Route_uri_encode_parameters
Browse files Browse the repository at this point in the history
Refix #4079: Decode slashes back after rawurlencode
  • Loading branch information
zeelot committed Mar 5, 2014
2 parents 9082a38 + 5c5aac1 commit 76ed4c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions classes/kohana/route.php
Expand Up @@ -458,7 +458,10 @@ public function uri(array $params = NULL)
{
if ($params)
{
// @issue #4079 rawurlencode parameters
$params = array_map('rawurlencode', $params);
// decode slashes back, see Apache docs about AllowEncodedSlashes and AcceptPathInfo
$params = str_replace(array('%2F', '%5C'), array('/', '\\'), $params);
}

// Start with the routed URI
Expand Down
2 changes: 1 addition & 1 deletion tests/kohana/RouteTest.php
Expand Up @@ -733,7 +733,7 @@ public function provider_route_uri_encode_parameters()
),
'article_name',
'Article name with special chars \\ ##',
'blog/article/Article%20name%20with%20special%20chars%20%5C%20%23%23'
'blog/article/Article%20name%20with%20special%20chars%20\\%20%23%23'
)
);
}
Expand Down

0 comments on commit 76ed4c5

Please sign in to comment.