Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#17111 closed Bug (fixed)

simple redirect_to: handle query strings with percent symbols

Reported by: acdha Owned by: cadams
Component: Generic views Version: 1.3
Severity: Normal Keywords: i18n
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

If you use django.views.generic.simple.redirect_to with query_string=True and the query string contains a % character followed a valid Python conversion character it will cause a TypeError later when url % kwargs is performed. This is particularly easy to encounter when your content includes things like UTF-8 escaped content as the leading %C3 will trigger reliably trigger a TypeError.

Attachments (1)

utf8-safe-redirect_to.patch (2.5 KB) - added by acdha 4 years ago.

Download all attachments as: .zip

Change History (6)

Changed 4 years ago by acdha

comment:1 Changed 4 years ago by acdha

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 4 years ago by julien

  • Triage Stage changed from Unreviewed to Ready for checkin

Good catch, thanks!

comment:3 Changed 4 years ago by julien

  • Resolution set to fixed
  • Status changed from new to closed

In [17034]:

Fixed #17111 -- Made the redirect_to generic view properly handle query strings with percent symbols. Thanks, Chris Adams.

comment:4 Changed 4 years ago by anonymous

Thanks for the fix, acdha. I set up redirect_to earlier today, was getting errors immediately from users, and am happy to see a quick fix!

comment:5 Changed 4 years ago by claudep

Seems the class-based generic view suffered from the same problem. Fix happens in #16842.

Note: See TracTickets for help on using tickets.
Back to Top