diff --git a/cake/libs/view/helpers/html.php b/cake/libs/view/helpers/html.php
index df3e5dc43..99927b219 100644
--- a/cake/libs/view/helpers/html.php
+++ b/cake/libs/view/helpers/html.php
@@ -313,7 +313,12 @@ class HtmlHelper extends AppHelper {
}
return;
}
- $url = $this->webroot((COMPRESS_CSS ? 'c' : '') . CSS_URL . $path . ".css");
+
+ if (strpos($path, '.css') === false && strpos($path, '?') === false) {
+ $path .= '.css';
+ }
+
+ $url = $this->webroot((COMPRESS_CSS ? 'c' : '') . CSS_URL . $path);
if ($rel == 'import') {
$out = sprintf($this->tags['style'], $this->_parseAttributes($htmlAttributes, null, '', ' '), '@import url(' . $url . ');');
} else {
diff --git a/cake/tests/cases/libs/view/helpers/html.test.php b/cake/tests/cases/libs/view/helpers/html.test.php
index d51c5e34d..7430ff4a0 100644
--- a/cake/tests/cases/libs/view/helpers/html.test.php
+++ b/cake/tests/cases/libs/view/helpers/html.test.php
@@ -79,6 +79,20 @@ class HtmlHelperTest extends UnitTestCase {
$this->assertPattern('/^]+type="text\/css"[^<>]+\/>$/', $result);
$this->assertPattern('/^]+href=".*css\/screen\.css"[^<>]+\/>$/', $result);
$this->assertNoPattern('/^]+[^rel|type|href]=[^<>]*>/', $result);
+
+ $result = $this->Html->css('screen.css');
+ $this->assertPattern('/^]+\/>$/', $result);
+ $this->assertPattern('/^]+rel="stylesheet"[^<>]+\/>$/', $result);
+ $this->assertPattern('/^]+type="text\/css"[^<>]+\/>$/', $result);
+ $this->assertPattern('/^]+href=".*css\/screen\.css"[^<>]+\/>$/', $result);
+ $this->assertNoPattern('/^]+[^rel|type|href]=[^<>]*>/', $result);
+
+ $result = $this->Html->css('screen.css?1234');
+ $this->assertPattern('/^]+\/>$/', $result);
+ $this->assertPattern('/^]+rel="stylesheet"[^<>]+\/>$/', $result);
+ $this->assertPattern('/^]+type="text\/css"[^<>]+\/>$/', $result);
+ $this->assertPattern('/^]+href=".*css\/screen\.css\?1234"[^<>]+\/>$/', $result);
+ $this->assertNoPattern('/^]+[^rel|type|href]=[^<>]*>/', $result);
}
function testBreadcrumb() {