mirror of
https://github.com/django/django.git
synced 2025-10-26 23:26:08 +00:00
Fixed #19101 -- Decoding of non-ASCII POST data on Python 3.
Thanks Claude Paroz.
This commit is contained in:
@@ -110,7 +110,7 @@ class MultiPartParser(object):
|
||||
# HTTP spec says that Content-Length >= 0 is valid
|
||||
# handling content-length == 0 before continuing
|
||||
if self._content_length == 0:
|
||||
return QueryDict(MultiValueDict(), encoding=self._encoding), MultiValueDict()
|
||||
return QueryDict('', encoding=self._encoding), MultiValueDict()
|
||||
|
||||
# See if the handler will want to take care of the parsing.
|
||||
# This allows overriding everything if somebody wants it.
|
||||
|
||||
@@ -276,6 +276,9 @@ class QueryDict(MultiValueDict):
|
||||
encoding = settings.DEFAULT_CHARSET
|
||||
self.encoding = encoding
|
||||
if six.PY3:
|
||||
if isinstance(query_string, bytes):
|
||||
# query_string contains URL-encoded data, a subset of ASCII.
|
||||
query_string = query_string.decode()
|
||||
for key, value in parse_qsl(query_string or '',
|
||||
keep_blank_values=True,
|
||||
encoding=encoding):
|
||||
|
||||
Reference in New Issue
Block a user