Browse files

Fragments should not be urlencoded()

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

Fixes #2755
  • Loading branch information...
1 parent b3419be commit fe1a6d7d7e271a53c94ca9f2637ca90e0c2f1815 @markstory markstory committed Apr 7, 2012
Showing with 2 additions and 2 deletions.
  1. +1 −1 lib/Cake/Routing/Router.php
  2. +1 −1 lib/Cake/Test/Case/Routing/RouterTest.php
View
2 lib/Cake/Routing/Router.php
@@ -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'])) {
View
2 lib/Cake/Test/Case/Routing/RouterTest.php
@@ -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);
}

0 comments on commit fe1a6d7

Please sign in to comment.