Fix utils.guess_mime / uploading with 0 byte files
This commit is contained in:
parent
e6541cd767
commit
a1f89ca9c4
|
@ -98,6 +98,8 @@ async def guess_mime(file: File) -> str:
|
||||||
first_chunk: bytes
|
first_chunk: bytes
|
||||||
async for first_chunk in async_generator_from_data(file):
|
async for first_chunk in async_generator_from_data(file):
|
||||||
break
|
break
|
||||||
|
else:
|
||||||
|
return "inode/x-empty" # empty file
|
||||||
|
|
||||||
# TODO: plaintext
|
# TODO: plaintext
|
||||||
mime = filetype.guess_mime(first_chunk)
|
mime = filetype.guess_mime(first_chunk)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user