-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Eliminate //
in paths
#1286
Eliminate //
in paths
#1286
Conversation
The only problematic but somewhat valid case I can think of is There should be a Like I was considering only merging slashes in static parts, not variable parts, of matched URLs, but that would get really complicated. I think it's OK to just merge everything. |
Also remember to add a changelog entry and a |
Doing the work in Oh, and probably if we want to go |
So I've done all that (I think). The top commit makes only static parts affected—as you can see it's not a whole lot of extra work, but I'm happy to remove it if you prefer the other thing. (Personally, I like that it eliminates the special case for One thing testing this threw up is that a |
82447eb
to
838ca91
Compare
One reason for supporting the switch to turn off collapsing slashes is that Werkzeug is used by moto (https://github.com/spulec/moto), a library emulating Amazon AWS infrastructure. Since double slashes are meaningful for Amazon's servers (see e.g. getmoto/moto#1637), Incidentally, the problem with paths starting with slashes mentioned above is also a problem for moto, so it would be great to have it fixed as well. |
@edk0 I've rebased and update the code style for this, but I can't push. Would you enable that option? |
d2ff0e0
to
bafe618
Compare
@edk0 would you review this and make sure I didn't bork anything during the rebase? |
Looks good to me. |
* don't merge slashes immediately after ':' * don't merge slashes on construction We don't know whether the Map wants us to yet, so there's no ideal place to do it at all. The associated warning and its corresponding test are removed. merge_slashes is now enforced at `Rule.compile` time for building as well as parsing. * merge slashes only in static parts
fix error in merge_slashes=False code rename paths in test for clarity
Incoming paths are redirected to remove repeated slashes upon matching. Rules containing repeated slashes collapse them to just one and send a warning.
I haven't included a way to turn this off; do people have reasons to?
closes #1132