Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

router with strict_slashes disabled doesn't match URL without slash #2482

Closed
pjulian opened this issue Aug 1, 2022 · 3 comments
Closed

router with strict_slashes disabled doesn't match URL without slash #2482

pjulian opened this issue Aug 1, 2022 · 3 comments
Assignees
Labels

Comments

@pjulian
Copy link

pjulian commented Aug 1, 2022

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. (NOTE: opposite of what was reported in bug report -> #2467)

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.

My app currently sets strict_slashes = False and all routes are returning a 404.

Environment:

  • Python version: 3.9
  • Werkzeug version: 2.2.x
@pjulian pjulian changed the title New router in 2.2.0 changes the behavior of strict_slashes. New router in 2.2.0 changes the behavior of strict_slashes (opposite of issue reported in #2467). Aug 1, 2022
@davidism davidism changed the title New router in 2.2.0 changes the behavior of strict_slashes (opposite of issue reported in #2467). router with strict_slashes disabled doesn't match URL without slash Aug 1, 2022
@pgjones
Copy link
Member

pgjones commented Aug 2, 2022

Duplicate of #2478. Please reopen if you disagree.

@pgjones pgjones closed this as not planned Won't fix, can't repro, duplicate, stale Aug 2, 2022
@pjulian
Copy link
Author

pjulian commented Aug 2, 2022

I might possibly agree that #2478 could be a bug report of the same issue ...

Correct me if I'm wrong, but the resolution of #2478 appears to be that the behavior WAS wrong before and has been FIXED in #1074? And all that was needed was to just update the change log to reflect an intentional change/fix in behavior?

The reporter in #2478 seems to be okay with simply updating the change log, but I'm not sure if I agree.

IMO, EITHER of the following should resolve to the same route (currently the latter is treated as if strict_slashes were True and causing /foo to return a 404):

Reported in #2467:

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

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

Being reported here #2482 (and I guess also possibly here #2478):

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

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

@pgjones
Copy link
Member

pgjones commented Aug 3, 2022

I see. I think #2487 is the solution to these issues. There are really three options people expect.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants