summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Godwin2022-12-17 12:16:37 -0700
committerAndrew Godwin2022-12-17 12:16:37 -0700
commit256ebe56d5f9f6d8e18ae61e9406a8d33ed4b1a1 (patch)
treed12d2493f22f01d15610bfee0242daada45e44f4
parent5bbcc0f6c3bef33e31d6d55c3a171245428434de (diff)
downloadtakahe-256ebe56d5f9f6d8e18ae61e9406a8d33ed4b1a1.tar.gz
takahe-256ebe56d5f9f6d8e18ae61e9406a8d33ed4b1a1.tar.bz2
takahe-256ebe56d5f9f6d8e18ae61e9406a8d33ed4b1a1.zip
Don't download files with no content-length
-rw-r--r--core/files.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/files.py b/core/files.py
index 3ef79aa..a3ac813 100644
--- a/core/files.py
+++ b/core/files.py
@@ -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)