Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#17111 closed Bug (fixed)

simple redirect_to: handle query strings with percent symbols

Reported by: Chris Adams 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 Chris Adams 5 years ago.

Download all attachments as: .zip

Change History (6)

Changed 5 years ago by Chris Adams

Attachment: utf8-safe-redirect_to.patch added

comment:1 Changed 5 years ago by Chris Adams

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

comment:2 Changed 5 years ago by Julien Phalip

Triage Stage: UnreviewedReady for checkin

Good catch, thanks!

comment:3 Changed 5 years ago by Julien Phalip

Resolution: fixed
Status: newclosed

In [17034]:

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

comment:4 Changed 5 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 5 years ago by Claude Paroz

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