#34377: AdminSite.catch_all_view() drops query string in redirects
-----------------------------------+------------------------------------
     Reporter:  Dominique Bischof  |                    Owner:  nobody
         Type:  Bug                |                   Status:  new
    Component:  contrib.admin      |                  Version:  4.1
     Severity:  Normal             |               Resolution:
     Keywords:                     |             Triage Stage:  Accepted
    Has patch:  0                  |      Needs documentation:  0
  Needs tests:  0                  |  Patch needs improvement:  0
Easy pickings:  0                  |                    UI/UX:  0
-----------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

 * cc: Carlton Gibson, Jon Dufresne (added)
 * easy:  1 => 0
 * stage:  Unreviewed => Accepted


Comment:

 Thanks for the report! Using `get_full_path()` should fix the issue:

 {{{#!diff
 diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py
 index 61be31d890..96c54e44ad 100644
 --- a/django/contrib/admin/sites.py
 +++ b/django/contrib/admin/sites.py
 @@ -453,7 +453,7 @@ class AdminSite:
                  pass
              else:
                  if getattr(match.func, "should_append_slash", True):
 -                    return HttpResponsePermanentRedirect("%s/" %
 request.path)
 +                    return
 HttpResponsePermanentRedirect(request.get_full_path(force_append_slash=True))
          raise Http404

      def _build_app_dict(self, request, label=None):
 }}}
 Would you like to prepare PR via GitHub? (a regression test is required.)

 Regression in ba31b0103442ac891fb3cb98f316781254e366c3.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34377#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070186a09ac34a-b96bda3c-b5a6-4d06-a5c9-c7b35625f012-000000%40eu-central-1.amazonses.com.

Reply via email to