Skip to content

Commit

Permalink
Fix for relative protocol on assets
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed Aug 3, 2013
1 parent 316c658 commit db6d0a7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
Expand Up @@ -414,6 +414,9 @@ public function testImageTag() {

$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' => '')));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/View/Helper.php
Expand Up @@ -322,7 +322,7 @@ public function assetUrl($path, $options = array()) {
) {
$path .= $options['ext'];
}
if (strpos($path, '://') !== false) {
if (preg_match('|^([a-z0-9]+:)?//|', $path)) {
return $path;
}
if (isset($plugin)) {
Expand Down

0 comments on commit db6d0a7

Please sign in to comment.