DjangoAdminHackers / django-linkcheck

An app that will analyze and report on links in any model that you register with it. Links can be bare (urls or image and file fields) or embedded in HTML (linkcheck handles the parsing). It's fairly easy to override methods of the Linkcheck object should you need to do anything more complicated (like generate URLs from slug fields etc).
BSD 3-Clause "New" or "Revised" License
75 stars 26 forks source link

Non-ascii characters in domain names are incorrectly URL encoded #190

Closed timobrembeck closed 1 year ago

timobrembeck commented 1 year ago

When a domain name contains non-ascii characters, they are url encoded, but they should be left as they are (since requests can convert them to punycode under the hood)...

In [1]: from linkcheck.models import Url

In [2]: url = Url(url="https://bafög.de")

In [3]: url.check_url()
Out[3]: False

In [4]: url.error_message
Out[4]: 'Connection Error: NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f13de75cb10>: Failed to resolve \'baf%c3%b6g.de\' ([Errno -2] Name or service not known)")'

While requests can handle the link (as long as it's not encoded):

In [1]: import requests

In [2]: requests.get("https://bafög.de")
Out[2]: <Response [200]>