1
0
mirror of https://github.com/django/django.git synced 2025-10-26 07:06:08 +00:00

Fixed #17592 -- Handle URLs starting with a dot when using urlize. Thanks, Claude Paroz.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17435 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jannis Leidel
2012-02-04 16:05:48 +00:00
parent 4d8a0f8902
commit e734477bd7
2 changed files with 8 additions and 1 deletions

View File

@@ -168,7 +168,10 @@ def urlize(text, trim_url_limit=None, nofollow=False, autoescape=False):
url = smart_urlquote('http://%s' % middle)
elif not ':' in middle and simple_email_re.match(middle):
local, domain = middle.rsplit('@', 1)
domain = domain.encode('idna')
try:
domain = domain.encode('idna')
except UnicodeError:
continue
url = 'mailto:%s@%s' % (local, domain)
nofollow_attr = ''