Code

Ticket #17133: django_script_path.patch

File django_script_path.patch, 710 bytes (added by mwilck, 18 months ago)

Suggested patch (for Django 1.3.1, but should apply on master as well)

  • django/core/handlers/base.py

    old new  
    227227            response = func(request, response) 
    228228        return response 
    229229 
     230import re 
     231_multislash = re.compile(r'/+') 
     232 
    230233def get_script_name(environ): 
    231234    """ 
    232235    Returns the equivalent of the HTTP request's SCRIPT_NAME environment 
     
    248251    if not script_url: 
    249252        script_url = environ.get('REDIRECT_URL', u'') 
    250253    if script_url: 
     254        script_url = _multislash.sub("/", script_url) 
    251255        return force_unicode(script_url[:-len(environ.get('PATH_INFO', ''))]) 
    252256    return force_unicode(environ.get('SCRIPT_NAME', u''))