Merge pull request #481 from lixxu/master

url_for has something wrong with //
This commit is contained in:
Eli Uriegas 2017-02-23 18:27:13 -06:00 committed by GitHub
commit 68c8796adb
2 changed files with 2 additions and 2 deletions

View File

@ -270,7 +270,7 @@ class Sanic:
'Endpoint with name `{}` was not found'.format(
view_name))
if uri.endswith('/'):
if uri != '/' and uri.endswith('/'):
uri = uri[:-1]
out = uri

View File

@ -41,7 +41,7 @@ class Blueprint:
# Prepend the blueprint URI prefix if available
uri = url_prefix + future.uri if url_prefix else future.uri
app.route(
uri=uri,
uri=uri[1:] if uri.startswith('//') else uri,
methods=future.methods,
host=future.host or self.host
)(future.handler)