Browse Source

Add re.sub for blueprint add_url_rule handler, prevent '/a//b/'(blueprint.url_prefix='/a/' and the route is '/b/') happened.

pull/2629/head
zcchen 7 years ago committed by David Lord
parent
commit
0887245bfd
No known key found for this signature in database
GPG Key ID: 7A1C87E3F5BC42A8
  1. 2
      flask/blueprints.py

2
flask/blueprints.py

@ -10,6 +10,7 @@
:license: BSD, see LICENSE for more details.
"""
import re
from functools import update_wrapper
from .helpers import _PackageBoundObject, _endpoint_from_view_func
@ -67,6 +68,7 @@ class BlueprintSetupState(object):
"""
if self.url_prefix:
rule = self.url_prefix + rule
rule = re.sub('/+', '/', rule)
options.setdefault('subdomain', self.subdomain)
if endpoint is None:
endpoint = _endpoint_from_view_func(view_func)

Loading…
Cancel
Save