fix bug in route loader causing requests for specific formats to not be returned correctly.

This commit is contained in:
Taylor Otwell
2011-08-10 22:45:19 -05:00
parent 3ba3089208
commit e4bc62da73

View File

@@ -50,6 +50,16 @@ class Loader {
*/
private function load_nested_routes($segments)
{
// If the request URI only more than one segment, and the last segment contains a dot, we will
// assume the request is for a specific format (users.json or users.xml) and strip off
// everything after the dot so we can load the appropriate file.
if (count($segments) > 0 and strpos(end($segments), '.') !== false)
{
$segment = array_pop($segments);
array_push($segments, substr($segment, 0, strpos($segment, '.')));
}
// Work backwards through the URI segments until we find the deepest possible
// matching route directory. Once we find it, we will return those routes.
foreach (array_reverse($segments, true) as $key => $value)