URL encode image/script/css/video paths.

Properly urlencode urls used in HTML attributes. This solves issues with
invalid HTML being generated when paths contain special characters.

Fixes #3395
This commit is contained in:
mark_story 2012-11-25 23:31:22 -05:00
parent b41705f59e
commit 1f35d82c81
2 changed files with 19 additions and 1 deletions

View file

@ -622,6 +622,9 @@ class HelperTest extends CakeTestCase {
$result = $this->Helper->assetUrl('style', array('ext' => '.css'));
$this->assertEquals('style.css', $result);
$result = $this->Helper->assetUrl('dir/sub dir/my image', array('ext' => '.jpg'));
$this->assertEquals('dir/sub%20dir/my%20image.jpg', $result);
$result = $this->Helper->assetUrl('foo.jpg?one=two&three=four');
$this->assertEquals('foo.jpg?one=two&three=four', $result);
}