Commit: f527e5449ee7ee0d9ad6a0579c894ed389062563

Author: gwoo | Date: 2010-02-15 18:08:39 -0800
fix for bad offset in asset filter
diff --git a/config/bootstrap.php b/config/bootstrap.php index 44f627d..452813c 100644 --- a/config/bootstrap.php +++ b/config/bootstrap.php @@ -15,17 +15,18 @@ use \lithium\core\Libraries; use \lithium\net\http\Media; Dispatcher::applyFilter('_callable', function($self, $params, $chain) { - list($plugin, $asset) = explode('/', $params['request']->url, 2); - $library = Libraries::get($plugin); - $asset = "{$library['path']}/webroot/{$asset}"; + list($plugin, $asset) = explode('/', $params['request']->url, 2) + array("", ""); + if ($asset && $library = Libraries::get($plugin)) { + $asset = "{$library['path']}/webroot/{$asset}"; - if (file_exists($asset)) { - return function () use ($asset) { - $info = pathinfo($asset); - $type = Media::type($info['extension']); - header("Content-type: {$type}"); - return file_get_contents($asset); - }; + if (file_exists($asset)) { + return function () use ($asset) { + $info = pathinfo($asset); + $type = Media::type($info['extension']); + header("Content-type: {$type}"); + return file_get_contents($asset); + }; + } } return $chain->next($self, $params, $chain); });