Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

django does not fill POST dictionary for non-forms since version 1.5 #6

Open
RubenGarcia opened this issue Sep 10, 2020 · 1 comment

Comments

@RubenGarcia
Copy link
Contributor

RubenGarcia commented Sep 10, 2020

django does not fill POST dictionary for non-forms since version 1.5
https://docs.djangoproject.com/en/2.2/ref/request-response/#django.http.HttpRequest.POST

My POST request from resumable.js looks like this:
<WSGIRequest: POST '/demo/resumable_upload?resumableChunkNumber=1&resumableChunkSize=1048576&resumableCurrentChunkSize=694&resumableTotalSize=694&resumableType=text%2Fplain&resumableIdentifier=694-readmetxt&resumableFilename=readme.txt&resumableRelativePath=readme.txt&resumableTotalChunks=1&content_type_id=application%2Foctet-stream&field_name=file'>

But
print (request.POST)
<QueryDict: {}>

The code fails in get_chunks_upload_to in the line
ct_id = request.POST['content_type_id']

with
Traceback (most recent call last):
django.utils.datastructures.MultiValueDictKeyError: 'content_type_id'

@RubenGarcia
Copy link
Contributor Author

Some of the parameters are repeated in the body:

b'------WebKitFormBoundaryJZK6sxhbWg1A7LGm\r\nContent-Disposition: form-data; name="resumableChunkNumber"\r\n\r\n1\r\n------WebKitFormBoundaryJZK6sxhbWg1A7LGm\r\nContent-Disposition: form-data; name="resumableChunkSize"\r\n\r\n1048576\r\n------WebKitFormBoundaryJZK6sxhbWg1A7LGm\r\nContent-Disposition: form-data; name="resumableCurrentChunkSize"\r\n\r\n694\r\n------WebKitFormBoundaryJZK6sxhbWg1A7LGm\r\nContent-Disposition: form-data; name="resumableTotalSize"\r\n\r\n694\r\n------WebKitFormBoundaryJZK6sxhbWg1A7LGm\r\nContent-Disposition: form-data; name="resumableType"\r\n\r\ntext/plain\r\n------WebKitFormBoundaryJZK6sxhbWg1A7LGm\r\nContent-Disposition: form-data; name="resumableIdentifier"\r\n\r\n694-readmetxt\r\n------WebKitFormBoundaryJZK6sxhbWg1A7LGm\r\nContent-Disposition: form-data; name="resumableFilename"\r\n\r\nreadme.txt\r\n------WebKitFormBoundaryJZK6sxhbWg1A7LGm\r\nContent-Disposition: form-data; name="resumableRelativePath"\r\n\r\nreadme.txt\r\n------WebKitFormBoundaryJZK6sxhbWg1A7LGm\r\nContent-Disposition: form-data; name="resumableTotalChunks"\r\n\r\n1\r\n------WebKitFormBoundaryJZK6sxhbWg1A7LGm\r\nContent-Disposition: form-data; name="content_type_id"\r\n\r\napplication/octet-stream\r\n------WebKitFormBoundaryJZK6sxhbWg1A7LGm\r\nContent-Disposition: form-data; name="field_name"\r\n\r\nfile\r\n------WebKitFormBoundaryJZK6sxhbWg1A7LGm\r\nContent-Disposition: form-data; name="file"; filename="readme.txt"\r\nContent-Type: application/octet-stream\r\n\r\n'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant