Fix utils.guess_mime / uploading with 0 byte files

This commit is contained in:
miruka 2019-12-18 16:52:39 -04:00
parent e6541cd767
commit a1f89ca9c4

View File

@ -98,6 +98,8 @@ async def guess_mime(file: File) -> str:
first_chunk: bytes
async for first_chunk in async_generator_from_data(file):
break
else:
return "inode/x-empty" # empty file
# TODO: plaintext
mime = filetype.guess_mime(first_chunk)