Skip to content

New router in 2.2.0 changes the behavior of strict_slashes #2467

@sirosen

Description

@sirosen

Under v2.1.0 and earlier, strict_slashes=False could be used to make a routing rule for /foo match /foo/ as well.
This appears to have changed in 2.2.0 , I'm guessing in #2433

Example flask app:

# app.py
import flask
app = flask.Flask(__name__)
app.url_map.strict_slashes = False

@app.route("/foo")
def foo():
    return "hi"

and then flask run and curl localhost:5000/foo/. Under v2.1.0 you should see hi, but under 2.2.0, a 404.


I ran into this at work, as we have an app which sets strict_slashes = False and a test in our testsuite which checks for the behavior.
I don't know that we have any clients which rely on the behavior, but others might not be so lucky.

The safety/backwards-compatibility implications of this are not something I want to argue too much. If this was considered a quirk of the router and never an intended behavior, presumably it's fine to change in v2.2.0 . Otherwise, needs a fix. 🙂

If the change is considered okay, I think it's missing from the changelog. It wasn't obvious to me why our tests failed with the updated flask/werkzeug versions from the changelogs, and I had to start looking at what merged.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions