We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When an URL already contains user and password, calling URL.to_path() is replacing special characters for strings that were already encoded.
The second assert in the following snippet fails, but it should pass:
from yarl import URL assert ( str(URL("http://user%name:pass%word@localhost/")) == "http://user%25name:pass%25word@localhost/" ) assert ( str(URL("http://user%name:pass%word@localhost/").with_port(9000)) == "http://user%25name:pass%25word@localhost:9000/" )
A URL user/password like "user%name" should be encoded as "user%25name", but calling to_path changes it to "user%2525name".
Traceback (most recent call last): File "/tmp/yarltesting.py", line 7, in <module> assert ( AssertionError
$ python --version Python 3.9.6
$ python -m pip show multidict Name: multidict Version: 5.1.0 Summary: multidict implementation Home-page: https://github.com/aio-libs/multidict Author: Andrew Svetlov Author-email: [email protected] License: Apache 2 Location: /home/elciok/.cache/pypoetry/virtualenvs/archiver-6vV8vJQs-py3.9/lib/python3.9/site-packages Requires: Required-by: yarl
$ python -m pip show yarl Name: yarl Version: 1.6.3 Summary: Yet another URL library Home-page: https://github.com/aio-libs/yarl/ Author: Andrew Svetlov Author-email: [email protected] License: Apache 2 Location: /home/elciok/.cache/pypoetry/virtualenvs/archiver-6vV8vJQs-py3.9/lib/python3.9/site-packages Requires: idna, multidict
$ lsb_release -a
LSB Version: core-9.20170808ubuntu1-noarch:printing-9.20170808ubuntu1-noarch:security-9.20170808ubuntu1-noarch Distributor ID: Ubuntu Description: Ubuntu 18.04.5 LTS Release: 18.04 Codename: bionic
No response
The text was updated successfully, but these errors were encountered:
We need a champion for the bug. Please feel free to create a Pull Request
Sorry, something went wrong.
elciok
Successfully merging a pull request may close this issue.
Describe the bug
When an URL already contains user and password, calling URL.to_path() is replacing special characters for strings that were already encoded.
To Reproduce
The second assert in the following snippet fails, but it should pass:
Expected behavior
A URL user/password like "user%name" should be encoded as "user%25name", but calling to_path changes it to "user%2525name".
Logs/tracebacks
Python Version
multidict Version
yarl Version
OS
$ lsb_release -a
LSB Version: core-9.20170808ubuntu1-noarch:printing-9.20170808ubuntu1-noarch:security-9.20170808ubuntu1-noarch
Distributor ID: Ubuntu
Description: Ubuntu 18.04.5 LTS
Release: 18.04
Codename: bionic
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: