You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Django closes transparently the elements of requests.FILES since django/django#2747 , but Django Rest Framework forgets doing so. In particular it leaves /tmp/*.upload files.
Django REST framework system is built on top of Django's. Moreover, I've seen cases where test failed because the file was closed during the API call.
I'm closing the issue due to the lack of evidences.
Will reconsider with a failing test case we can reproduce.
Here curl -F file=@/tmp/fff http://localhost:8080/A/ does not leave /tmp/.....upload file, but curl -F file=@/tmp/fff http://localhost:8080/Z/ leaves.
Hi @dilyanpalauzov - the demo definitely demonstrates that temporary files remain after the request has been processed by DRF. DRF's stream processing is preempting Django's own data/files handling, so the underlying Django request object doesn't have any _files to close.
Would you be willing to open a PR with a failing test case?
Activity
xordoquy commentedon Jun 12, 2017
Django REST framework system is built on top of Django's. Moreover, I've seen cases where test failed because the file was closed during the API call.
I'm closing the issue due to the lack of evidences.
Will reconsider with a failing test case we can reproduce.
dilyanpalauzov commentedon Jun 12, 2017
demo.zip
Here
curl -F file=@/tmp/fff http://localhost:8080/A/does not leave /tmp/.....upload file, butcurl -F file=@/tmp/fff http://localhost:8080/Z/leaves.Note
FILE_UPLOAD_HANDLERS = ['django.core.files.uploadhandler.TemporaryFileUploadHandler']rpkilby commentedon Jul 6, 2017
Hi @dilyanpalauzov - the demo definitely demonstrates that temporary files remain after the request has been processed by DRF. DRF's stream processing is preempting Django's own data/files handling, so the underlying Django request object doesn't have any
_filesto close.Would you be willing to open a PR with a failing test case?
dilyanpalauzov commentedon Jul 6, 2017
I do not have the time to delve how to write test cases.