mirror of
https://github.com/jointakahe/takahe.git
synced 2025-02-23 10:46:15 +00:00
Don't download files with no content-length
This commit is contained in:
parent
5bbcc0f6c3
commit
256ebe56d5
1 changed files with 1 additions and 1 deletions
|
@ -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 a new issue