diff --git a/cake/libs/view/helpers/html.php b/cake/libs/view/helpers/html.php index ee209e1bf..8ef8406ec 100644 --- a/cake/libs/view/helpers/html.php +++ b/cake/libs/view/helpers/html.php @@ -344,7 +344,7 @@ class HtmlHelper extends AppHelper { } if (strpos($path, '?') === false) { - if (strpos($path, '.css') === false) { + if (substr($path, -4) !== '.css') { $path .= '.css'; } } diff --git a/cake/libs/view/helpers/javascript.php b/cake/libs/view/helpers/javascript.php index 330627a9f..21eab7f44 100644 --- a/cake/libs/view/helpers/javascript.php +++ b/cake/libs/view/helpers/javascript.php @@ -249,7 +249,7 @@ class JavascriptHelper extends AppHelper { $url = JS_URL . $url; } if (strpos($url, '?') === false) { - if (strpos($url, '.js') === false) { + if (substr($url, -3) !== '.js') { $url .= '.js'; } } diff --git a/cake/tests/cases/libs/view/helpers/html.test.php b/cake/tests/cases/libs/view/helpers/html.test.php index ab365a535..635e908bf 100644 --- a/cake/tests/cases/libs/view/helpers/html.test.php +++ b/cake/tests/cases/libs/view/helpers/html.test.php @@ -362,6 +362,10 @@ class HtmlHelperTest extends CakeTestCase { $result = $this->Html->css('screen.css'); $this->assertTags($result, $expected); + $result = $this->Html->css('my.css.library'); + $expected['link']['href'] = 'preg:/.*css\/my\.css\.library\.css/'; + $this->assertTags($result, $expected); + $result = $this->Html->css('screen.css?1234'); $expected['link']['href'] = 'preg:/.*css\/screen\.css\?1234/'; $this->assertTags($result, $expected); diff --git a/cake/tests/cases/libs/view/helpers/javascript.test.php b/cake/tests/cases/libs/view/helpers/javascript.test.php index 5bb4cb713..fceb01343 100644 --- a/cake/tests/cases/libs/view/helpers/javascript.test.php +++ b/cake/tests/cases/libs/view/helpers/javascript.test.php @@ -166,6 +166,10 @@ class JavascriptTest extends CakeTestCase { $expected = ''; $this->assertEqual($result, $expected); + $result = $this->Javascript->link('some.json.libary'); + $expected = ''; + $this->assertEqual($result, $expected); + $result = $this->Javascript->link('jquery-1.1.2'); $expected = ''; $this->assertEqual($result, $expected);