Don't download files with no content-length

This commit is contained in:
Andrew Godwin 2022-12-17 12:16:37 -07:00
parent 5bbcc0f6c3
commit 256ebe56d5
1 changed files with 1 additions and 1 deletions

View File

@ -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)