Refs #30509 -- Adjusted internal FileResponse variable name.

Follow up to dc724c5bf9.
This commit is contained in:
Carlton Gibson 2021-10-15 07:29:55 +02:00 committed by GitHub
parent 15683cdb95
commit 4a58dfd9db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -438,7 +438,7 @@ class FileResponse(StreamingHttpResponse):
def __init__(self, *args, as_attachment=False, filename='', **kwargs): def __init__(self, *args, as_attachment=False, filename='', **kwargs):
self.as_attachment = as_attachment self.as_attachment = as_attachment
self.filename = filename self.filename = filename
self._no_default_content_type_set = 'content_type' not in kwargs or kwargs['content_type'] is None self._no_explicit_content_type = 'content_type' not in kwargs or kwargs['content_type'] is None
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
def _set_streaming_content(self, value): def _set_streaming_content(self, value):
@ -476,7 +476,7 @@ class FileResponse(StreamingHttpResponse):
filelike.seek(-int(self.headers['Content-Length']), io.SEEK_END) filelike.seek(-int(self.headers['Content-Length']), io.SEEK_END)
filename = os.path.basename(self.filename or filename) filename = os.path.basename(self.filename or filename)
if self._no_default_content_type_set: if self._no_explicit_content_type:
if filename: if filename:
content_type, encoding = mimetypes.guess_type(filename) content_type, encoding = mimetypes.guess_type(filename)
# Encoding isn't set to prevent browsers from automatically # Encoding isn't set to prevent browsers from automatically