diff --git a/tests/test_url.py b/tests/test_url.py index 085cf78d..c93aef3e 100644 --- a/tests/test_url.py +++ b/tests/test_url.py @@ -345,13 +345,6 @@ def test_path_with_spaces(): assert "/a b" == url.path -def test_path_with_2F(): - """Path should not decode %2F, otherwise it may look like a path separator.""" - - url = URL("http://example.com/foo/bar%2fbaz") - assert url.path == "/foo/bar%2Fbaz" - - def test_raw_path_for_empty_url(): url = URL() assert "" == url.raw_path diff --git a/yarl/_quoting_c.pyi b/yarl/_quoting_c.pyi index 1dc1a5b3..6832bf80 100644 --- a/yarl/_quoting_c.pyi +++ b/yarl/_quoting_c.pyi @@ -12,7 +12,5 @@ class _Quoter: def __call__(self, val: str = ...) -> str: ... class _Unquoter: - def __init__( - self, *, ignore: str = ..., unsafe: str = ..., qs: bool = ... - ) -> None: ... + def __init__(self, *, unsafe: str = ..., qs: bool = ...) -> None: ... def __call__(self, val: str = ...) -> str: ... diff --git a/yarl/_quoting_c.pyx b/yarl/_quoting_c.pyx index 6ac44fdf..96f69c14 100644 --- a/yarl/_quoting_c.pyx +++ b/yarl/_quoting_c.pyx @@ -269,14 +269,12 @@ cdef class _Quoter: cdef class _Unquoter: - cdef str _ignore cdef str _unsafe cdef bint _qs cdef _Quoter _quoter cdef _Quoter _qs_quoter - def __init__(self, *, ignore="", unsafe="", qs=False): - self._ignore = ignore + def __init__(self, *, unsafe='', qs=False): self._unsafe = unsafe self._qs = qs self._quoter = _Quoter() @@ -338,7 +336,7 @@ cdef class _Unquoter: buflen = 0 if self._qs and unquoted in '+=&;': ret.append(self._qs_quoter(unquoted)) - elif unquoted in self._unsafe or unquoted in self._ignore: + elif unquoted in self._unsafe: ret.append(self._quoter(unquoted)) else: ret.append(unquoted) diff --git a/yarl/_quoting_py.py b/yarl/_quoting_py.py index e5b1d3a3..86d9a02f 100644 --- a/yarl/_quoting_py.py +++ b/yarl/_quoting_py.py @@ -116,8 +116,7 @@ def __call__(self, val: str) -> str: class _Unquoter: - def __init__(self, *, ignore: str = "", unsafe: str = "", qs: bool = False) -> None: - self._ignore = ignore + def __init__(self, *, unsafe: str = "", qs: bool = False) -> None: self._unsafe = unsafe self._qs = qs self._quoter = _Quoter() @@ -159,7 +158,7 @@ def __call__(self, val: str) -> str: if to_add is None: # pragma: no cover raise RuntimeError("Cannot quote None") ret.append(to_add) - elif unquoted in self._unsafe or unquoted in self._ignore: + elif unquoted in self._unsafe: to_add = self._quoter(unquoted) if to_add is None: # pragma: no cover raise RuntimeError("Cannot quote None") diff --git a/yarl/_url.py b/yarl/_url.py index 01f9d8fa..f506eac6 100644 --- a/yarl/_url.py +++ b/yarl/_url.py @@ -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