Commit e4bc62da authored by Taylor Otwell's avatar Taylor Otwell

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

parent 3ba30892
...@@ -50,6 +50,16 @@ class Loader { ...@@ -50,6 +50,16 @@ class Loader {
*/ */
private function load_nested_routes($segments) 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 // Work backwards through the URI segments until we find the deepest possible
// matching route directory. Once we find it, we will return those routes. // matching route directory. Once we find it, we will return those routes.
foreach (array_reverse($segments, true) as $key => $value) foreach (array_reverse($segments, true) as $key => $value)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment