Closed
Description
from werkzeug.routing import Rule, Map
routes = Map([
Rule("/merge/<some>/path"),
])
def get_redirect_location(path):
try:
routes.bind("test.host").match(path)
except Exception as e:
return e.get_response({}).headers['location']
else:
raise ValueError("no redirect")
def test_merge_slashes():
assert get_redirect_location("/merge/%//path") == 'http://test.host/merge/%25/path'
It looks like Rule.match
uses Rule.build
to generate the new path here, which is already urlencoded. But then MapAdapter.match
encodes the resulting path again here.
Environment:
- Python version: 3.9.5
- Werkzeug version: 2.0.1
Metadata
Metadata
Assignees
Labels
No labels