fix bug in route loader causing requests for specific formats to not be returned correctly.
This commit is contained in:
parent
3ba3089208
commit
e4bc62da73
|
|
@ -50,6 +50,16 @@ public function load($uri)
|
||||||
*/
|
*/
|
||||||
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)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue