Browse files

Fix theme files with spaces in them.

Fixes #2324
  • Loading branch information...
1 parent faddfbe commit 79d6a850add28a1e07454be773ddda33294e4f80 @markstory markstory committed Dec 1, 2011
View
4 lib/Cake/Routing/Dispatcher.php
@@ -272,7 +272,7 @@ public function asset($url, CakeResponse $response) {
if ($parts[0] === 'theme') {
$themeName = $parts[1];
unset($parts[0], $parts[1]);
- $fileFragment = implode(DS, $parts);
+ $fileFragment = urldecode(implode(DS, $parts));
$path = App::themePath($themeName) . 'webroot' . DS;
if (file_exists($path . $fileFragment)) {
$assetFile = $path . $fileFragment;
@@ -281,7 +281,7 @@ public function asset($url, CakeResponse $response) {
$plugin = Inflector::camelize($parts[0]);
if (CakePlugin::loaded($plugin)) {
unset($parts[0]);
- $fileFragment = implode(DS, $parts);
+ $fileFragment = urldecode(implode(DS, $parts));
$pluginWebroot = CakePlugin::path($plugin) . 'webroot' . DS;
if (file_exists($pluginWebroot . $fileFragment)) {
$assetFile = $pluginWebroot . $fileFragment;
View
4 lib/Cake/Test/Case/Routing/DispatcherTest.php
@@ -1230,6 +1230,10 @@ public static function assetProvider() {
'View/Themed/TestTheme/webroot/js/one/theme_one.js'
),
array(
+ 'theme/test_theme/space%20image.text',
+ 'View/Themed/TestTheme/webroot/space image.text'
+ ),
+ array(
'test_plugin/root.js',
'Plugin/TestPlugin/webroot/root.js'
),
View
1 lib/Cake/Test/test_app/View/Themed/TestTheme/webroot/space image.text
@@ -0,0 +1 @@
+This is not an image.

0 comments on commit 79d6a85

Please sign in to comment.