Skip to content

Commit

Permalink
Restore unquoting of %2F in paths (#1151)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Sep 23, 2024
1 parent 6795a59 commit 497752c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES/1151.breaking.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Restore decoding ``%2F`` (``/``) in ``URL.path`` -- by :user:`bdraco`.

This change restored the behavior before :issue:`1136`.
4 changes: 2 additions & 2 deletions tests/test_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,10 @@ def test_path_with_spaces():


def test_path_with_2F():
"""Path should not decode %2F, otherwise it may look like a path separator."""
"""Path should decode %2F."""

url = URL("http://example.com/foo/bar%2fbaz")
assert url.path == "/foo/bar%2Fbaz"
assert url.path == "/foo/bar/baz"


def test_raw_path_for_empty_url():
Expand Down
2 changes: 1 addition & 1 deletion yarl/_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ class URL:
_FRAGMENT_REQUOTER = _Quoter(safe="?/:@")

_UNQUOTER = _Unquoter()
_PATH_UNQUOTER = _Unquoter(ignore="/", unsafe="+")
_PATH_UNQUOTER = _Unquoter(unsafe="+")
_QS_UNQUOTER = _Unquoter(qs=True)

_val: SplitResult
Expand Down

0 comments on commit 497752c

Please sign in to comment.