Ticket #16020: 08-urlize-encoded-spaces-correctly-16020.diff

File 08-urlize-encoded-spaces-correctly-16020.diff, 1.1 KB (added by Chris Lamb, 14 years ago)
  • django/utils/html.py

    diff --git a/django/utils/html.py b/django/utils/html.py
    index 7fda015..459bf54 100644
    a b def urlize(text, trim_url_limit=None, nofollow=False, autoescape=False):  
    129129            # Make URL we want to point to.
    130130            url = None
    131131            if middle.startswith('http://') or middle.startswith('https://'):
    132                 url = urlquote(middle, safe='/&=:;#?+*')
     132                url = urlquote(middle, safe='/&=:;#?+*%')
    133133            elif middle.startswith('www.') or ('@' not in middle and \
    134134                    middle and middle[0] in string.ascii_letters + string.digits and \
    135135                    (middle.endswith('.org') or middle.endswith('.net') or middle.endswith('.com'))):
    136                 url = urlquote('http://%s' % middle, safe='/&=:;#?+*')
     136                url = urlquote('http://%s' % middle, safe='/&=:;#?+*%')
    137137            elif '@' in middle and not ':' in middle and simple_email_re.match(middle):
    138138                url = 'mailto:%s' % middle
    139139                nofollow_attr = ''
Back to Top