Fragments should not be urlencoded()

encoding them breaks fragments for client side
applications like backbone.js

Fixes #2755
This commit is contained in:
mark_story 2012-04-06 21:32:37 -04:00
parent b3419be0fb
commit fe1a6d7d7e
2 changed files with 2 additions and 2 deletions

View file

@ -778,7 +778,7 @@ class Router {
unset($url['?']);
}
if (isset($url['#'])) {
$frag = '#' . urlencode($url['#']);
$frag = '#' . $url['#'];
unset($url['#']);
}
if (isset($url['ext'])) {

View file

@ -527,7 +527,7 @@ class RouterTest extends CakeTestCase {
$this->assertEquals('/posts/index/0', $result);
$result = Router::url(array('controller' => 'posts', '0', '?' => 'var=test&var2=test2', '#' => 'unencoded string %'));
$expected = '/posts/index/0?var=test&var2=test2#unencoded+string+%25';
$expected = '/posts/index/0?var=test&var2=test2#unencoded string %';
$this->assertEquals($expected, $result);
}