Fixed bug that occurs on calling @app.route or any of it's variants
causes a route to be added twice. One without the slash, the other with the Setting strict_slashes to false when a route does not end with slashes slash. This is ok if the Router._add method runs linearly, but problematic when it runs recursively. Unfortunately recursion is triggered when the host param to the Router._add function is a list of hosts.
This commit is contained in:
parent
6d37ef7256
commit
60774c5a49
|
@ -128,6 +128,13 @@ class Router:
|
|||
if strict_slashes:
|
||||
return
|
||||
|
||||
if not isinstance(host, str) and host is not None:
|
||||
# we have gotten back to the top of the recursion tree where the
|
||||
# host was originally a list. By now, we've processed the strict
|
||||
# slashes logic on the leaf nodes (the individual host strings in
|
||||
# the list of host)
|
||||
return
|
||||
|
||||
# Add versions with and without trailing /
|
||||
slashed_methods = self.routes_all.get(uri + '/', frozenset({}))
|
||||
unslashed_methods = self.routes_all.get(uri[:-1], frozenset({}))
|
||||
|
|
Loading…
Reference in New Issue
Block a user