fix: update Content-Disposition header for binary as attachment
This commit is contained in:
parent
a73d3f54cf
commit
4a9af04f94
2 changed files with 4 additions and 2 deletions
|
|
@ -483,7 +483,9 @@ class TestAPIResponse(FrappeAPITestCase):
|
|||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response.headers["content-type"], "application/octet-stream")
|
||||
self.assertGreater(cint(response.headers["content-length"]), 0)
|
||||
self.assertEqual(response.headers["content-disposition"], f'filename="{encoded_filename}"')
|
||||
self.assertEqual(
|
||||
response.headers["content-disposition"], f'attachment; filename="{encoded_filename}"'
|
||||
)
|
||||
|
||||
def test_download_private_file_with_unique_url(self):
|
||||
test_content = frappe.generate_hash()
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ def as_binary():
|
|||
response.mimetype = "application/octet-stream"
|
||||
filename = frappe.response["filename"]
|
||||
filename = filename.encode("utf-8").decode("unicode-escape", "ignore")
|
||||
response.headers.add("Content-Disposition", None, filename=filename)
|
||||
response.headers.add("Content-Disposition", "attachment", filename=filename)
|
||||
response.data = frappe.response["filecontent"]
|
||||
return response
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue