From 0887245bfde8e5d65cc3d807dc574a0a07511eb4 Mon Sep 17 00:00:00 2001 From: zcchen Date: Mon, 12 Feb 2018 18:38:54 +0800 Subject: [PATCH] Add re.sub for blueprint add_url_rule handler, prevent '/a//b/'(blueprint.url_prefix='/a/' and the route is '/b/') happened. --- flask/blueprints.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flask/blueprints.py b/flask/blueprints.py index 6291c3c0..5d8bfaae 100644 --- a/flask/blueprints.py +++ b/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)