﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
4074	admin interface filter.html does not encode url attributes properly	tony.perkins@…	nobody	"If you filter on a field that has a value that includes an ampersand when selecting that value to filter on it does not work.

The output of filter.html for an example

 
{{{
<li>
    <a href=""?title=Escapade%20-%20Adult%20Kayak%20&amp;%20Snorkel,%20Northwest%20Maui"">Escapade - Adult Kayak &amp; Snorkel, Northwest Maui</a></li>

}}}

I tried using the urlencode filter, but it encodes the ? as well which causes it to fail also.
    <a href=""{{ choice.query_string|urlencode }}"">{{ choice.display|escape }}</a></li>



'''If I change the following it works. ''I know this is not the right place.'''''

In filter.html
change
    <a href=""{{ choice.query_string }}"">{{ choice.display|escape }}</a></li>
to
    <a href=""{{ choice.query_string|fix_ampersands }}"">{{ choice.display|escape }}</a></li>

in html.py
change
  
{{{
def fix_ampersands(value):
    ""Returns the given HTML with all unencoded ampersands encoded correctly""
    return unencoded_ampersands_re.sub('&amp;', value)
}}}
to
{{{
  def fix_ampersands(value):
    ""Returns the given HTML with all unencoded ampersands encoded correctly""
    return unencoded_ampersands_re.sub('%26', value)

}}}
"		closed	contrib.admin	newforms-admin		fixed	ampersand filter	robert@…	Ready for checkin	1	0	0	0	0	0
