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:
|
try:
|
||||||
content_length = int(stream.headers["content-length"])
|
content_length = int(stream.headers["content-length"])
|
||||||
allow_download = content_length <= max_size
|
allow_download = content_length <= max_size
|
||||||
except TypeError:
|
except (KeyError, TypeError):
|
||||||
pass
|
pass
|
||||||
if allow_download:
|
if allow_download:
|
||||||
file = ContentFile(await stream.aread(), name=url)
|
file = ContentFile(await stream.aread(), name=url)
|
||||||
|
|
Loading…
Reference in New Issue