aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2020-12-14 00:16:36 +0000
committerGravatar GitHub <[email protected]>2020-12-14 00:16:36 +0000
commit4f8eefdf3b2b36034b1fbe5cdc02c3e7274fcd7e (patch)
tree9ffff4bcf8efc953accdbb860b7c266267fcb40a
parentMerge pull request #24 from python-discord/fix-data-sanitisation (diff)
parentSort routes to have constants first and path fragments last (diff)
Merge pull request #25 from python-discord/bugfix/route-collision
Sort routes to have constants first and path fragments last
-rw-r--r--backend/route_manager.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/backend/route_manager.py b/backend/route_manager.py
index 3d83ee7..25529eb 100644
--- a/backend/route_manager.py
+++ b/backend/route_manager.py
@@ -20,6 +20,9 @@ def construct_route_map_from_dict(route_dict: dict) -> list:
else:
route_map.append(Mount(mount, routes=construct_route_map_from_dict(item)))
+ # Order non-capturing routes before capturing routes
+ route_map.sort(key=lambda route: "{" in route.path)
+
return route_map