﻿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
22267	django.utils.html.smart_urlquote() is incorrectly unquoting the url	meenzam@…	Md. Enzam Hossain	"When we give django.utils.html.smart_urlquote() an url with an already embedded query as a query paramater, it is unquoting it which it should not do.

For example,
{{{ smart_urlquote('http://example.com/?q=http%3A%2F%2Fexample.com%2F%3Fx%3D1%26q%3Ddjango') }}}
returns
'http://example.com/?q=http://example.com/?x=1&q=django'
which has the query parameters {{{ {'q': ['http://example.com/?x=1', 'django']} }}}

where it should have returned the exact url back
'http://example.com/?q=http%3A%2F%2Fexample.com%2F%3Fx%3D1%26q%3Ddjango'
which has the query parameters {{{ {'q': ['http://example.com/?x=1&q=django']} }}}

I have written a test here - https://github.com/ienzam/django/blob/master/tests/utils_tests/test_html.py#L203
{{{
        # Ensure that embedded quoted url does not get unquoted
        self.assertEqual(
            quote('http://example.com/?q=http%3A%2F%2Fexample.com%2F%3Fx%3D1%26q%3Ddjango'),
            'http://example.com/?q=http%3A%2F%2Fexample.com%2F%3Fx%3D1%26q%3Ddjango')
}}}"	Bug	closed	Utilities	dev	Normal	fixed		meenzam@… Kevin Brown	Ready for checkin	1	0	0	0	0	0
