mirror of
https://github.com/zulip/zulip.git
synced 2026-06-24 21:08:25 +08:00
Don't convert to POST vars if POST is already populated.
Otherwise you could encounter errors if you POST to a method with this decorator applied. (imported from commit bcb31f336ea2a1eeee6b9e3e9dfeed1d205ae26a)
This commit is contained in:
parent
50809ca219
commit
3fd2bfa19e
@ -124,11 +124,14 @@ def process_as_post(view_func):
|
||||
#
|
||||
# This will not be required in the future, a bug will be filed against
|
||||
# Django upstream.
|
||||
if request.META.get('CONTENT_TYPE', '').startswith('multipart'):
|
||||
request.POST = MultiPartParser(request.META, StringIO(request.body),
|
||||
[], request.encoding).parse()[0]
|
||||
else:
|
||||
request.POST = QueryDict(request.body, encoding=request.encoding)
|
||||
|
||||
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]
|
||||
else:
|
||||
request.POST = QueryDict(request.body, encoding=request.encoding)
|
||||
|
||||
return view_func(request, *args, **kwargs)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user