Hi all,
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%3F
x%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%3F
x%3D1%26q%3Ddjango'),
            'http://example.com/?q=http%3A%2F%2Fexample.com%2F%3F
x%3D1%26q%3Ddjango')

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ad1a76e4-c8b4-47d8-8959-daf88a7428b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to