mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed #22996 -- Prevented crash with unencoded query string
Thanks Jorge Carleitao for the report and Aymeric Augustin, Tim Graham for the reviews.
This commit is contained in:
parent
11d9cbe2f4
commit
fa02120d36
5 changed files with 43 additions and 13 deletions
|
@ -203,14 +203,14 @@ class QueryDictTests(unittest.TestCase):
|
|||
def test_invalid_input_encoding(self):
|
||||
"""
|
||||
QueryDicts must be able to handle invalid input encoding (in this
|
||||
case, bad UTF-8 encoding).
|
||||
case, bad UTF-8 encoding), falling back to ISO-8859-1 decoding.
|
||||
|
||||
This test doesn't apply under Python 3 because the URL is a string
|
||||
and not a bytestring.
|
||||
"""
|
||||
q = QueryDict(str(b'foo=bar&foo=\xff'))
|
||||
self.assertEqual(q['foo'], '\ufffd')
|
||||
self.assertEqual(q.getlist('foo'), ['bar', '\ufffd'])
|
||||
self.assertEqual(q['foo'], '\xff')
|
||||
self.assertEqual(q.getlist('foo'), ['bar', '\xff'])
|
||||
|
||||
def test_pickle(self):
|
||||
q = QueryDict()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue