mirror of https://github.com/zulip/zulip.git
Support request.FILES in process_as_post.
(imported from commit 646019b5efe4ae3f6f66f99f76f2036d9fd9ec8e)
This commit is contained in:
parent
a02fe71788
commit
2b28cf9a0a
|
@ -141,8 +141,11 @@ def process_as_post(view_func):
|
|||
if not request.POST:
|
||||
# Only take action if POST is empty.
|
||||
if request.META.get('CONTENT_TYPE', '').startswith('multipart'):
|
||||
request.POST = MultiPartParser(request.META, StringIO(request.body),
|
||||
[], request.encoding).parse()[0]
|
||||
# Note that request._files is just the private attribute that backs the
|
||||
# FILES property, so we are essentially setting request.FILES here. (In
|
||||
# Django 1.5 FILES was still a read-only property.)
|
||||
request.POST, request._files = MultiPartParser(request.META, StringIO(request.body),
|
||||
request.upload_handlers, request.encoding).parse()
|
||||
else:
|
||||
request.POST = QueryDict(request.body, encoding=request.encoding)
|
||||
|
||||
|
|
Loading…
Reference in New Issue