Code

Ticket #8381: 8381-r8423-2.diff

File 8381-r8423-2.diff, 959 bytes (added by jcassee, 6 years ago)
Line 
1Index: django/middleware/common.py
2===================================================================
3--- django/middleware/common.py (revision 8423)
4+++ django/middleware/common.py (working copy)
5@@ -54,7 +54,7 @@
6         # trailing slash and there is no pattern for the current path
7         if settings.APPEND_SLASH and (not old_url[1].endswith('/')):
8             try:
9-                urlresolvers.resolve(request.path)
10+                urlresolvers.resolve(request.path_info)
11             except urlresolvers.Resolver404:
12                 new_url[1] = new_url[1] + '/'
13                 if settings.DEBUG and request.method == 'POST':
14@@ -69,7 +69,7 @@
15         if new_url != old_url:
16             # Redirect if the target url exists
17             try:
18-                urlresolvers.resolve(new_url[1])
19+                urlresolvers.resolve(request.path_info + '/')
20             except urlresolvers.Resolver404:
21                 pass
22             else: