Setting proper filename in Content-Disposition
This commit is contained in:
parent
7ddcaac4cd
commit
c380b2d902
@ -1106,8 +1106,12 @@ class BulkDownloadView(GenericAPIView):
|
||||
strategy.add_document(doc)
|
||||
|
||||
with open(temp.name, "rb") as f:
|
||||
response = HttpResponse(f, content_type="application/zip")
|
||||
response["Content-Disposition"] = "attachment"
|
||||
file_extension = "pdf" if single_file else "zip"
|
||||
|
||||
response = HttpResponse(f, content_type=f"application/{file_extension}")
|
||||
response[
|
||||
"Content-Disposition"
|
||||
] = f'attachment; filename="documents.{file_extension}"'
|
||||
|
||||
return response
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user