summaryrefslogtreecommitdiff
path: root/django/http
diff options
context:
space:
mode:
author007 <007gzs@gmail.com>2020-02-21 13:25:22 +0800
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-02-28 14:43:16 +0100
commite65fea9292ffdeb9bb76062f6cb2a5ff514ae969 (patch)
tree994b6d3c9ccf4b2b9b7a2f51e6a98a8b1476d888 /django/http
parenta21f7b91db273a03abfb47b0580bb39e0043c99a (diff)
Fixed #31293 -- Allowed MultiPartParser to handle double-quoted encoded headers.
Diffstat (limited to 'django/http')
-rw-r--r--django/http/multipartparser.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/django/http/multipartparser.py b/django/http/multipartparser.py
index fd8fce8b4d..33d8814241 100644
--- a/django/http/multipartparser.py
+++ b/django/http/multipartparser.py
@@ -664,12 +664,12 @@ def parse_header(line):
if p.count(b"'") == 2:
has_encoding = True
value = p[i + 1:].strip()
- if has_encoding:
- encoding, lang, value = value.split(b"'")
- value = unquote(value.decode(), encoding=encoding.decode())
if len(value) >= 2 and value[:1] == value[-1:] == b'"':
value = value[1:-1]
value = value.replace(b'\\\\', b'\\').replace(b'\\"', b'"')
+ if has_encoding:
+ encoding, lang, value = value.split(b"'")
+ value = unquote(value.decode(), encoding=encoding.decode())
pdict[name] = value
return key, pdict