Skip to content

Commit

Permalink
Fragments should not be urlencoded()
Browse files Browse the repository at this point in the history
encoding them breaks fragments for client side
applications like backbone.js

Fixes #2755
  • Loading branch information
markstory committed Apr 7, 2012
1 parent b3419be commit fe1a6d7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/Cake/Routing/Router.php
Expand Up @@ -778,7 +778,7 @@ public static function url($url = null, $full = false) {
unset($url['?']);
}
if (isset($url['#'])) {
$frag = '#' . urlencode($url['#']);
$frag = '#' . $url['#'];
unset($url['#']);
}
if (isset($url['ext'])) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Test/Case/Routing/RouterTest.php
Expand Up @@ -527,7 +527,7 @@ public function testUrlGenerationWithQueryStrings() {
$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);
}

Expand Down

0 comments on commit fe1a6d7

Please sign in to comment.