routes
routes copied to clipboard
Change in order of route matching from #89
I believe https://github.com/bbangert/routes/pull/89/ introduced coder that results in a different ordering for routes being matched. I think a reproducible case would be:
mapper.connect("Foo action", "/api/{version}/foo/action", controller=controller, action=an_action, conditions={"method": ["GET"]}, requirements={"version": V1_REGEX})
mapper.connect("Get foo", "/api/v1/foo/{foo_id}", controller=controller, action=get_action, conditions={"method": ["GET"]}, requirements={})
Although the 2nd path is registered second, because it has a longer static prefix it will match first. Previously, routes would have been guaranteed to match in the order that they were registered. There are workarounds (e.g. ensure routes use the same prefix), however, this is unexpected.
I don't have a concrete suggestion for fixing this optimization at the moment, other than limiting its scope to specific instances of route lists where these overlaps do not occur.
For the time being, would it be possible to revert #89?
Yep, I'll look at reversing that unless you'd like to get a PR up to undo it. I should be able to get to it within the week otherwise.