From 12dc3c57b23ec6cea28b6086ac9703190d7531ac Mon Sep 17 00:00:00 2001 From: Trenton H <797416+stumpylog@users.noreply.github.com> Date: Fri, 14 Mar 2025 09:45:23 -0700 Subject: [PATCH] Set Content-Length directly, Django isn't guessing it --- src/documents/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/documents/views.py b/src/documents/views.py index 312409e9e..3f69d3c26 100644 --- a/src/documents/views.py +++ b/src/documents/views.py @@ -2036,7 +2036,10 @@ class BulkDownloadView(GenericAPIView): for document in documents: strategy.add_document(document) - return FileResponse(zip_file.open("rb"), as_attachment=True) + response = FileResponse(zip_file.open("rb"), as_attachment=True) + response["Content-Length"] = zip_file.stat().st_size + + return response @extend_schema_view(**generate_object_with_permissions_schema(StoragePathSerializer))