]> git.ipfire.org Git - thirdparty/jinja.git/commitdiff
Fixed an issue about urlize function 193/head
authormozillazg <opensource.mozillazg@gmail.com>
Mon, 18 Mar 2013 06:27:54 +0000 (14:27 +0800)
committermozillazg <opensource.mozillazg@gmail.com>
Mon, 18 Mar 2013 06:27:54 +0000 (14:27 +0800)
When URL startswith 'https://', the return is wrong.
Before:

    >>> urlize('https://github.com/')
    u'<a href="http://https://github.com/">https://github.com/</a>'
After:

    >>> urlize('https://github.com/')
    u'<a href="https://github.com/">https://github.com/</a>'

jinja2/utils.py

index 568c63f9f8b1accb390fa755241bd53b0c3e78de..402718d9d0bb7c6091caea8c57a0fa30ae57b91b 100644 (file)
@@ -284,6 +284,7 @@ def urlize(text, trim_url_limit=None, nofollow=False):
             if middle.startswith('www.') or (
                 '@' not in middle and
                 not middle.startswith('http://') and
+                not middle.startswith('https://') and
                 len(middle) > 0 and
                 middle[0] in _letters + _digits and (
                     middle.endswith('.org') or