From 256ebe56d5f9f6d8e18ae61e9406a8d33ed4b1a1 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Sat, 17 Dec 2022 12:16:37 -0700 Subject: Don't download files with no content-length --- core/files.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core') 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) -- cgit v1.2.3