Don't download files with no content-length
This commit is contained in:
parent
5bbcc0f6c3
commit
256ebe56d5
|
@ -58,7 +58,7 @@ async def get_remote_file(
|
|||
try:
|
||||
content_length = int(stream.headers["content-length"])
|
||||
allow_download = content_length <= max_size
|
||||
except TypeError:
|
||||
except (KeyError, TypeError):
|
||||
pass
|
||||
if allow_download:
|
||||
file = ContentFile(await stream.aread(), name=url)
|
||||
|
|
Loading…
Reference in New Issue