diff --git a/lib/Cake/Test/Case/View/HelperTest.php b/lib/Cake/Test/Case/View/HelperTest.php index 564b6dc203d..b588fda7e4a 100644 --- a/lib/Cake/Test/Case/View/HelperTest.php +++ b/lib/Cake/Test/Case/View/HelperTest.php @@ -660,6 +660,9 @@ public function testAssetUrl() { $result = $this->Helper->assetUrl('foo.jpg?one=two&three=four'); $this->assertEquals('foo.jpg?one=two&three=four', $result); + + $result = $this->Helper->assetUrl('dir/big+tall/image', array('ext' => '.jpg')); + $this->assertEquals('dir/big%2Btall/image.jpg', $result); } /** @@ -674,7 +677,8 @@ public function testAssetUrlNoRewrite() { 'here' => '/cake_dev/index.php/tasks', )); $result = $this->Helper->assetUrl('img/cake.icon.png', array('fullBase' => true)); - $this->assertEquals('http://localhost/cake_dev/app/webroot/img/cake.icon.png', $result); + + $this->assertEquals($result, 'http://' . $_SERVER['HTTP_HOST'] . '/cake_dev/app/webroot/img/cake.icon.png'); } /** diff --git a/lib/Cake/View/Helper.php b/lib/Cake/View/Helper.php index 847f5d84181..52f7796018c 100644 --- a/lib/Cake/View/Helper.php +++ b/lib/Cake/View/Helper.php @@ -341,7 +341,7 @@ public function assetUrl($path, $options = array()) { */ protected function _encodeUrl($url) { $path = parse_url($url, PHP_URL_PATH); - $parts = array_map('urldecode', explode('/', $path)); + $parts = array_map('rawurldecode', explode('/', $path)); $parts = array_map('rawurlencode', $parts); $encoded = implode('/', $parts); return h(str_replace($path, $encoded, $url));