Skip to content
New issue

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

Sometimes URL.human_repr() produces inequivalent URLs #511

Closed
serhiy-storchaka opened this issue Sep 26, 2020 · 0 comments · Fixed by #512
Closed

Sometimes URL.human_repr() produces inequivalent URLs #511

serhiy-storchaka opened this issue Sep 26, 2020 · 0 comments · Fixed by #512

Comments

@serhiy-storchaka
Copy link
Contributor

For example:

>>> u = URL('http://bob:%40malware.com%2F@example.org/path')
>>> str(u)
'http://bob:%40malware.com%2F@example.org/path'
>>> u.host
'example.org'
>>> u.human_repr()
'http://bob:@malware.com/@example.org/path'
>>> URL(u.human_repr()).host
'malware.com'

There are similar problems with user, path and query.

I think that human_repr() should produce a string which will produce the equivalent URL when passed to the URL constructor. It means that all corresponding delimiters and % should be %-encoded. It is worth to encode also non-printable characters.

@helpr helpr bot added the pr-available label Sep 26, 2020
@webknjaz webknjaz added the bug label Sep 26, 2020
@webknjaz webknjaz changed the title human_repr() can produce not equivalent URL Sometimes URL.human_repr() produces inequivalent URLs Sep 26, 2020
@helpr helpr bot added pr-merged and removed pr-available labels Sep 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants