Code

Ticket #19594: get_script_name.patch

File get_script_name.patch, 572 bytes (added by francisl, 18 months ago)

django.core.handles.base.get_script_name correct unexpected condition when extra slashes at the end of the url

  • django/core/handlers/base.py

    diff --git a/django/core/handlers/base.py b/django/core/handlers/base.py
    index d653860..238ee51 100644
    a b def get_script_name(environ): 
    247247    script_url = environ.get('SCRIPT_URL', u'') 
    248248    if not script_url: 
    249249        script_url = environ.get('REDIRECT_URL', u'') 
    250     if script_url: 
     250    if script_url and settings.FORCE_SCRIPT_NAME is not None: 
    251251        return force_unicode(script_url[:-len(environ.get('PATH_INFO', ''))]) 
    252252    return force_unicode(environ.get('SCRIPT_NAME', u''))