Opened 17 years ago

Closed 17 years ago

#5983 closed (fixed)

iriencode doesn't respect safe strings

Reported by: Antonis Christofides <anthony@…> Owned by: nobody
Component: Template system Version: dev
Severity: Keywords: auto-escaping
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This happens probably since autoescape. Steps to reproduce:

  1. In a model, use the following:
        class Admin:
            list_filter = ['column_a', 'column_b']
    

and you'll have two filters shown in the admin.

  1. Choose something other than "All" in the first filter
  1. Hover the mouse over something other than "All" in the second filter and look at the url.

Result: It will have a "&amp;" somewhere, when it should only have a "&". It doesn't work if you click it, of course.

See also #5976 for a related bug.

Attachments (1)

safe_iriencode.diff (1.6 KB ) - added by Chris Beaven 17 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 by Chris Beaven, 17 years ago

I narrowed it down to django/contrib/admin/templates/admin/filter.html - choice.querystring is SafeData, but iriencode doesn't respect that and it gets re-escaped.

Solution seems to be marking the iriencode filter with is_safe, since it doesn't introduce dangerous characters - so a safe string in means a safe string out.

comment:2 by Chris Beaven, 17 years ago

Triage Stage: UnreviewedAccepted

(oh, and I can confirm this buggy behaviour)

by Chris Beaven, 17 years ago

Attachment: safe_iriencode.diff added

comment:3 by Chris Beaven, 17 years ago

Component: Admin interfaceTemplate system
Has patch: set
Keywords: auto-escaping added
Summary: Admin escapes ampersands in URLs when joining filtersiriencode doesn't respect safe strings
Triage Stage: AcceptedReady for checkin

Changing the topic to reflect the real cause of the issue.

comment:4 by Malcolm Tredinnick, 17 years ago

Resolution: fixed
Status: newclosed

(In [6706]) Fixed #5983 -- Made iriencode filter respect safe strings. Patch from
SmileyChris.

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