Skip to content

ValueError in unquoter #516

@serhiy-storchaka

Description

@serhiy-storchaka
>>> URL.build(path='/%xx', encoded=True).path
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/serhiy/py/yarl/yarl/_url.py", line 50, in __get__
    val = self.wrapped(inst)
  File "/home/serhiy/py/yarl/yarl/_url.py", line 544, in path
    return self._PATH_UNQUOTER(self.raw_path)
  File "yarl/_quoting_c.pyx", line 293, in yarl._quoting_c._Unquoter.__call__
    return self._do_unquote(<str>val)
  File "yarl/_quoting_c.pyx", line 307, in yarl._quoting_c._Unquoter._do_unquote
    pcts.append(int(pct[1:], base=16))
ValueError: invalid literal for int() with base 16: 'xx'

The same is in pure Python implementation:

>>> URL.build(path='/%xx', encoded=True).path
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/serhiy/py/yarl/yarl/_url.py", line 50, in __get__
    val = self.wrapped(inst)
  File "/home/serhiy/py/yarl/yarl/_url.py", line 544, in path
    return self._PATH_UNQUOTER(self.raw_path)
  File "/home/serhiy/py/yarl/yarl/_quoting_py.py", line 137, in __call__
    pcts.append(int(pct[1:], base=16))
ValueError: invalid literal for int() with base 16: 'xx'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions