Skip to content
Myr

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

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by zcchen · committed by David Lord · parent f808c20 · Browse files · 1 file+2 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−0 removed

  • other:+2 added−0 removed

1 file+2 added−0 removed

modified:flask/blueprints.py+2 added
8 unmodified lines
9 :copyright: © 2010 by the Pallets team.10 :license: BSD, see LICENSE for more details.11"""1213import re14from functools import update_wrapper1516from .helpers import _PackageBoundObject, _endpoint_from_view_func17
49 unmodified lines
67 blueprint's name.68 """69 if self.url_prefix:70 rule = self.url_prefix + rule71 rule = re.sub('/+', '/', rule)72 options.setdefault('subdomain', self.subdomain)73 if endpoint is None:74 endpoint = _endpoint_from_view_func(view_func)75 defaults = self.url_defaults
372 unmodified lines