summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/http/response.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/django/http/response.py b/django/http/response.py
index 5168834b23..560e2ac7a5 100644
--- a/django/http/response.py
+++ b/django/http/response.py
@@ -442,6 +442,8 @@ class FileResponse(StreamingHttpResponse):
if hasattr(value, 'read'):
self.file_to_stream = value
filelike = value
+ if hasattr(filelike, 'close'):
+ self._closable_objects.append(filelike)
value = iter(lambda: filelike.read(self.block_size), b'')
else:
self.file_to_stream = None