mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-22 15:14:44 +00:00
Merge pull request #281 from cjmayo/python3_30
{python3_30} Python3: fix decoding strings
This commit is contained in:
commit
492058a360
2 changed files with 5 additions and 4 deletions
|
|
@ -158,7 +158,7 @@ class MailtoUrl (urlbase.UrlBase):
|
|||
{"addr": mail}, valid=False, overwrite=False)
|
||||
return
|
||||
# note: be sure to use rsplit since "@" can occur in local part
|
||||
local, domain = mail.rsplit("@", 1)
|
||||
local, domain = urlutil.decode_for_unquote(mail).rsplit("@", 1)
|
||||
if not local:
|
||||
self.set_result(_("Missing local part of mail address `%(addr)s'.") % \
|
||||
{"addr": mail}, valid=False, overwrite=False)
|
||||
|
|
@ -247,7 +247,7 @@ class MailtoUrl (urlbase.UrlBase):
|
|||
from dns.exception import DNSException
|
||||
log.debug(LOG_CHECK, "checking mail address %r", mail)
|
||||
mail = strformat.ascii_safe(mail)
|
||||
username, domain = mail.rsplit('@', 1)
|
||||
username, domain = urlutil.decode_for_unquote(mail).rsplit('@', 1)
|
||||
log.debug(LOG_CHECK, "looking up MX mailhost %r", domain)
|
||||
try:
|
||||
answers = resolver.query(domain, 'MX')
|
||||
|
|
|
|||
|
|
@ -256,8 +256,9 @@ def url_fix_common_typos (url):
|
|||
|
||||
def url_fix_mailto_urlsplit (urlparts):
|
||||
"""Split query part of mailto url if found."""
|
||||
if "?" in urlparts[2]:
|
||||
urlparts[2], urlparts[3] = urlparts[2].split('?', 1)
|
||||
sep = b"?" if isinstance(urlparts[2], bytes) else u"?"
|
||||
if sep in urlparts[2]:
|
||||
urlparts[2], urlparts[3] = urlparts[2].split(sep, 1)
|
||||
|
||||
# wayback urls include in the path http[s]://. By default the
|
||||
# tidying mechanism in linkchecker encodes the : and deletes the second slash
|
||||
|
|
|
|||
Loading…
Reference in a new issue