mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-22 23:24:44 +00:00
Prevent Unicode errors for non-ASCII emails
Prevent Unicode errors when email address contains non-ASCII characters. git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@3673 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
860def8d34
commit
1730097265
3 changed files with 20 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
|||
4.9 "" (released xx.xx.2008)
|
||||
4.9 "Michael Clayton" (released xx.xx.2008)
|
||||
|
||||
* Parse Shockwave Flash (SWF) for URLs to check
|
||||
Type: feature
|
||||
|
|
@ -18,6 +18,11 @@
|
|||
Type: bugfix
|
||||
Changed: config/linkchecker-completion
|
||||
|
||||
* Prevent unicode errors when an email address contains non-ascii
|
||||
characters.
|
||||
Type: bugfix
|
||||
Changed: linkcheck/checker/mailtourl.py
|
||||
|
||||
4.8 "Hallam Foe" (released 16.12.2007)
|
||||
|
||||
* Fix message typo for not disclosing information.
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import email.Utils
|
|||
|
||||
import urlbase
|
||||
import linkcheck.log
|
||||
import linkcheck.strformat
|
||||
import linkcheck.dns.resolver
|
||||
from const import WARN_MAIL_NO_ADDRESSES, WARN_MAIL_NO_MX_HOST, \
|
||||
WARN_MAIL_UNVERIFIED_ADDRESS, WARN_MAIL_NO_CONNECTION
|
||||
|
|
@ -151,6 +152,7 @@ class MailtoUrl (urlbase.UrlBase):
|
|||
"checking mail address %r", mail)
|
||||
assert None == linkcheck.log.debug(linkcheck.LOG_CHECK,
|
||||
"splitting address")
|
||||
mail = linkcheck.strformat.ascii_safe(mail)
|
||||
username, domain = _split_address(mail)
|
||||
assert None == linkcheck.log.debug(linkcheck.LOG_CHECK,
|
||||
"looking up MX mailhost %r", domain)
|
||||
|
|
|
|||
|
|
@ -152,6 +152,18 @@ class TestMail (linkcheck.checker.tests.LinkCheckTest):
|
|||
]
|
||||
self.direct(url, resultlines)
|
||||
|
||||
def test_unicode_mail (self):
|
||||
mailto = u"mailto:ölvin@users.sourceforge.net"
|
||||
url = self.norm(mailto)
|
||||
resultlines = [
|
||||
u"url %s" % url,
|
||||
u"cache key %s" % mailto,
|
||||
u"real url %s" % url,
|
||||
u"warning Unverified address: <lvin@users.sourceforge.net> Unrouteable address.",
|
||||
u"valid",
|
||||
]
|
||||
self.direct(url, resultlines)
|
||||
|
||||
|
||||
def test_suite ():
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue