Skip to content

Commit

Permalink
Add re.sub for blueprint add_url_rule handler, prevent '/a//b/'(bluep…
Browse files Browse the repository at this point in the history
…rint.url_prefix='/a/' and the route is '/b/') happened.
  • Loading branch information
zcchen authored and davidism committed Feb 23, 2018
1 parent f808c20 commit 0887245
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions flask/blueprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -67,6 +68,7 @@ def add_url_rule(self, rule, endpoint=None, view_func=None, **options):
"""
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)
Expand Down

0 comments on commit 0887245

Please sign in to comment.