Flask: Flask 1.0 backwards-incompat with double-slash/no-slash re. #2629

Created on 27 Apr 2018  路  1Comment  路  Source: pallets/flask

This is a major backwards-compat breaking change, but I suspect not the intended design and hopefully easy to fix.

The issue is related to PR #2629, and this example follows from that:

Given blueprint bp and app app:

@bp.route('b/')
def tmp():
    return "URI should be '/a/b/"

app.register_blueprint(bp, url_prefix='/a/')

In Flask 0.12 the URL is correctly /a/b, but in Flask 1.0 it's /ab.

Since issue #2629 relates to resolve double-slashes, I imagine this is a bug (and not a design decision) - and the correct solution would be to remove a slash only when there are two.

blueprints bug

Most helpful comment

While I personally think that omitting the leading slash in the blueprint URL and putting it in the prefix instead is absolutely awful (it looks ugly, and breaks if no url prefix is used) I agree that this kind of breakage is probably not a good thing and it'd be better to only strip duplicate slashes.

>All comments

While I personally think that omitting the leading slash in the blueprint URL and putting it in the prefix instead is absolutely awful (it looks ugly, and breaks if no url prefix is used) I agree that this kind of breakage is probably not a good thing and it'd be better to only strip duplicate slashes.

Was this page helpful?
0 / 5 - 0 ratings