Skip to content

geturl() of the ParseResultBytes can't get correct url #57

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

Closed
tRexCheng opened this issue Jun 5, 2019 · 4 comments · Fixed by #68
Closed

geturl() of the ParseResultBytes can't get correct url #57

tRexCheng opened this issue Jun 5, 2019 · 4 comments · Fixed by #68

Comments

@tRexCheng
Copy link

When I run geturl() of the instance of the ParseResultBytes, it just return "http:"

>>> print(parsed)
ParseResultBytes(scheme=b'https', userinfo=None, host=b'xn--i-7iq.ws', port=None, path=None, query=None, fragment=None)
>>> parsed.geturl()
b'https:'
@sethmlarson
Copy link
Member

I'm unable to reproduce your issue, can you show your whole workflow as to how you arrived at parsed?

>>> import rfc3986
>>> rfc3986.__version__
'1.3.2'
>>> parsed = rfc3986.urlparse("https://xn--i-7iq.ws").encode("utf-8")
>>> parsed
ParseResultBytes(scheme=b'https', userinfo=None, host=b'xn--i-7iq.ws', port=None, path=None, query=None, fragment=None)
>>> parsed.geturl()
b'https://xn--i-7iq.ws'

@tRexCheng
Copy link
Author

tRexCheng commented Jun 6, 2019

That's my workflow

>>> import rfc3986
>>> rfc3986.__version__
'1.3.2'
>>> parsed = rfc3986.urlparse("https://i❤.ws")
>>> parsed
ParseResult(scheme='https', userinfo=None, host='i❤.ws', port=None, path=None, query=None, fragment=None)
>>> encoded = parsed.encode('idna')
>>> encoded
ParseResultBytes(scheme=b'https', userinfo=None, host=b'xn--i-7iq.ws', port=None, path=None, query=None, fragment=None)
>>> encoded.geturl()
b'https:'

@sigmavirus24
Copy link
Collaborator

I can reproduce this. Thanks for reporting it.

>>> parsed = rfc3986.urlparse("https://i❤.ws")
>>> parsed.geturl()
u'https://i\u2764.ws'
>>> parsed.encode('idna').geturl()
'https:'

@sigmavirus24
Copy link
Collaborator

sigmavirus24 commented Apr 8, 2020

Interestingly, I can only reproduce this on Python 2 though Nevermind. The test I added didn't have assert in front of the check for equality. 🤦‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants