﻿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
13260	urlresolvers.reverse() generates invalid URLs when an argument contains % character	Ilya Semenov	Aymeric Augustin	"If I call django.core.urlresolvers.reverse() where one of (string) args contains a percent character (""%""), it generates an invalid URL: the percent symbols are not replaced with %25. Interestingly, space characters are properly replaced with %20.

Consider the following example:
{{{
#!python

# urls.py

urlpatterns = patterns('',
    (r'^download/(.*)$', 'myapp.views.download'),
)

# views.py

def download(request, filename):
    pass

# somewhere else

filename = '100% completed.png'
print reverse('myapp.views.download', args=[filename]) # /download/100%%20completed.png - malformed URL, Apache replies with 400 Bad Request error code
print reverse('myapp.views.download', args=[urlquote(filename)]) # /download/100%25%20completed.png - correct URL
}}}

reverse() should call urlquote() itself - because there's never any point NOT to do that. Moreover, the current implementation '''forces''' a user to apply urlquote() for each and every string parameter, otherwise there's always a chance that an invalid URL would be generated."	Bug	closed	Core (URLs)	dev	Normal	fixed		hv@… ben@… erikrose	Accepted	1	0	0	0	0	0
