Fix for relative protocol on assets

This commit is contained in:
Juan Basso 2013-05-28 00:02:49 -04:00
parent 316c6582ea
commit db6d0a748b
2 changed files with 4 additions and 1 deletions

View file

@ -414,6 +414,9 @@ class HtmlHelperTest extends CakeTestCase {
$result = $this->Html->image('test.gif', array('pathPrefix' => 'http://cakephp.org/assets/img/'));
$this->assertTags($result, array('img' => array('src' => 'http://cakephp.org/assets/img/test.gif', 'alt' => '')));
$result = $this->Html->image('test.gif', array('pathPrefix' => '//cakephp.org/assets/img/'));
$this->assertTags($result, array('img' => array('src' => '//cakephp.org/assets/img/test.gif', 'alt' => '')));
}
/**

View file

@ -322,7 +322,7 @@ class Helper extends Object {
) {
$path .= $options['ext'];
}
if (strpos($path, '://') !== false) {
if (preg_match('|^([a-z0-9]+:)?//|', $path)) {
return $path;
}
if (isset($plugin)) {