Ticket #8381: 8381-r8423-2.diff

File 8381-r8423-2.diff, 959 bytes (added by jcassee, 7 years ago)
  • django/middleware/common.py

     
    5454        # trailing slash and there is no pattern for the current path
    5555        if settings.APPEND_SLASH and (not old_url[1].endswith('/')):
    5656            try:
    57                 urlresolvers.resolve(request.path)
     57                urlresolvers.resolve(request.path_info)
    5858            except urlresolvers.Resolver404:
    5959                new_url[1] = new_url[1] + '/'
    6060                if settings.DEBUG and request.method == 'POST':
     
    6969        if new_url != old_url:
    7070            # Redirect if the target url exists
    7171            try:
    72                 urlresolvers.resolve(new_url[1])
     72                urlresolvers.resolve(request.path_info + '/')
    7373            except urlresolvers.Resolver404:
    7474                pass
    7575            else:
Back to Top