forked from orbit-oss/flask
Add re.sub for blueprint add_url_rule handler, prevent '/a//b/'(blueprint.url_prefix='/a/' and the route is '/b/') happened.
This commit is contained in:
parent
f808c20139
commit
0887245bfd
1 changed files with 2 additions and 0 deletions
|
|
@ -10,6 +10,7 @@
|
||||||
:license: BSD, see LICENSE for more details.
|
:license: BSD, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import re
|
||||||
from functools import update_wrapper
|
from functools import update_wrapper
|
||||||
|
|
||||||
from .helpers import _PackageBoundObject, _endpoint_from_view_func
|
from .helpers import _PackageBoundObject, _endpoint_from_view_func
|
||||||
|
|
@ -67,6 +68,7 @@ class BlueprintSetupState(object):
|
||||||
"""
|
"""
|
||||||
if self.url_prefix:
|
if self.url_prefix:
|
||||||
rule = self.url_prefix + rule
|
rule = self.url_prefix + rule
|
||||||
|
rule = re.sub('/+', '/', rule)
|
||||||
options.setdefault('subdomain', self.subdomain)
|
options.setdefault('subdomain', self.subdomain)
|
||||||
if endpoint is None:
|
if endpoint is None:
|
||||||
endpoint = _endpoint_from_view_func(view_func)
|
endpoint = _endpoint_from_view_func(view_func)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue