Merge pull request #36187 from ljain112/fix-export

This commit is contained in:
Sagar Vora 2026-01-22 17:45:49 +05:30 committed by GitHub
commit 3ad5c63d8a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View file

@ -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()

View file

@ -159,7 +159,7 @@ def as_pdf():
response = Response()
response.mimetype = "application/pdf"
filename = frappe.response["filename"].encode("utf-8").decode("unicode-escape", "ignore")
response.headers.add("Content-Disposition", None, filename=filename)
response.headers.add("Content-Disposition", "inline", filename=filename)
response.data = frappe.response["filecontent"]
return response
@ -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