mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 20:40:14 +03:00
Improve test of whether file was parsed successfully.
bool(file) is True iff file.filename is non-empty, so if there's no filename associated (e.g. no content-disposition) it wouldn't otherwise detect that a file upload handler successfully handled a file.
This commit is contained in:
parent
b07d931261
commit
38ac5bef3f
|
@ -276,7 +276,7 @@ class FileUploadParser(BaseParser):
|
|||
|
||||
for index, handler in enumerate(upload_handlers):
|
||||
file_obj = handler.file_complete(counters[index])
|
||||
if file_obj:
|
||||
if file_obj is not None:
|
||||
return DataAndFiles({}, {'file': file_obj})
|
||||
raise ParseError("FileUpload parse error - "
|
||||
"none of upload handlers can handle the stream")
|
||||
|
|
Loading…
Reference in New Issue
Block a user