Skip to content

Commit

Permalink
Fix blueprint route for ""
Browse files Browse the repository at this point in the history
  • Loading branch information
lepture committed May 1, 2018
1 parent 3fd7abe commit f7a3bdc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion flask/blueprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ def add_url_rule(self, rule, endpoint=None, view_func=None, **options):
blueprint's name.
"""
if self.url_prefix is not None:
rule = '/'.join((self.url_prefix, rule.lstrip('/')))
if rule:
rule = '/'.join((self.url_prefix, rule.lstrip('/')))
else:
rule = self.url_prefix
options.setdefault('subdomain', self.subdomain)
if endpoint is None:
endpoint = _endpoint_from_view_func(view_func)
Expand Down
1 change: 1 addition & 0 deletions tests/test_blueprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def bp_forbidden():


@pytest.mark.parametrize(('prefix', 'rule', 'url'), (
('/foo', '', '/foo'),
('/foo/', '/bar', '/foo/bar'),
('/foo/', 'bar', '/foo/bar'),
('/foo', '/bar', '/foo/bar'),
Expand Down

0 comments on commit f7a3bdc

Please sign in to comment.