Loading django/utils/html.py +1 −1 Original line number Diff line number Diff line Loading @@ -99,7 +99,7 @@ def urlize(text, trim_url_limit=None, nofollow=False, autoescape=False): lead, middle, trail = match.groups() if safe_input: middle = mark_safe(middle) if middle.startswith('www.') or ('@' not in middle and not middle.startswith('http://') and \ if middle.startswith('www.') or ('@' not in middle and not (middle.startswith('http://') or middle.startswith('https://')) and \ len(middle) > 0 and middle[0] in string.ascii_letters + string.digits and \ (middle.endswith('.org') or middle.endswith('.net') or middle.endswith('.com'))): middle = 'http://%s' % middle Loading tests/regressiontests/defaultfilters/tests.py +21 −0 Original line number Diff line number Diff line Loading @@ -166,6 +166,27 @@ u'<a href="http://31characteruri.com/test/" rel="nofollow">http://31characteruri >>> urlizetrunc(uri, 2) u'<a href="http://31characteruri.com/test/" rel="nofollow">...</a>' # Check normal urlize >>> urlize('http://google.com') u'<a href="http://google.com" rel="nofollow">http://google.com</a>' >>> urlize('http://google.com/') u'<a href="http://google.com/" rel="nofollow">http://google.com/</a>' >>> urlize('www.google.com') u'<a href="http://www.google.com" rel="nofollow">http://www.google.com</a>' >>> urlize('djangoproject.org') u'<a href="http://djangoproject.org" rel="nofollow">http://djangoproject.org</a>' >>> urlize('info@djangoproject.org') u'<a href="mailto:info@djangoproject.org">info@djangoproject.org</a>' # Check urlize with https addresses >>> urlize('https://google.com') u'<a href="https://google.com" rel="nofollow">https://google.com</a>' >>> wordcount('') 0 Loading Loading
django/utils/html.py +1 −1 Original line number Diff line number Diff line Loading @@ -99,7 +99,7 @@ def urlize(text, trim_url_limit=None, nofollow=False, autoescape=False): lead, middle, trail = match.groups() if safe_input: middle = mark_safe(middle) if middle.startswith('www.') or ('@' not in middle and not middle.startswith('http://') and \ if middle.startswith('www.') or ('@' not in middle and not (middle.startswith('http://') or middle.startswith('https://')) and \ len(middle) > 0 and middle[0] in string.ascii_letters + string.digits and \ (middle.endswith('.org') or middle.endswith('.net') or middle.endswith('.com'))): middle = 'http://%s' % middle Loading
tests/regressiontests/defaultfilters/tests.py +21 −0 Original line number Diff line number Diff line Loading @@ -166,6 +166,27 @@ u'<a href="http://31characteruri.com/test/" rel="nofollow">http://31characteruri >>> urlizetrunc(uri, 2) u'<a href="http://31characteruri.com/test/" rel="nofollow">...</a>' # Check normal urlize >>> urlize('http://google.com') u'<a href="http://google.com" rel="nofollow">http://google.com</a>' >>> urlize('http://google.com/') u'<a href="http://google.com/" rel="nofollow">http://google.com/</a>' >>> urlize('www.google.com') u'<a href="http://www.google.com" rel="nofollow">http://www.google.com</a>' >>> urlize('djangoproject.org') u'<a href="http://djangoproject.org" rel="nofollow">http://djangoproject.org</a>' >>> urlize('info@djangoproject.org') u'<a href="mailto:info@djangoproject.org">info@djangoproject.org</a>' # Check urlize with https addresses >>> urlize('https://google.com') u'<a href="https://google.com" rel="nofollow">https://google.com</a>' >>> wordcount('') 0 Loading