V0.8.4 Missing parameters in BOM export CSV format (#4476)

Fixes #3907
This commit is contained in:
Matthias Mair 2023-03-09 03:01:32 +01:00 committed by GitHub
parent 93a2d612e2
commit 7372f2b714
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -525,6 +525,7 @@ def DownloadFile(data, filename, content_type='application/text', inline=False)
A StreamingHttpResponse object wrapping the supplied data
"""
filename = WrapWithQuotes(filename)
length = len(data)
if type(data) == str:
wrapper = FileWrapper(io.StringIO(data))
@ -532,7 +533,9 @@ def DownloadFile(data, filename, content_type='application/text', inline=False)
wrapper = FileWrapper(io.BytesIO(data))
response = StreamingHttpResponse(wrapper, content_type=content_type)
response['Content-Length'] = len(data)
if type(data) == str:
length = len(bytes(data, response.charset))
response['Content-Length'] = length
disposition = "inline" if inline else "attachment"