From dac74cc8cabdc5e3ad0e90fc9aff3b6beedc964f Mon Sep 17 00:00:00 2001 From: Felix Hammerl Date: Wed, 10 Feb 2016 17:27:15 +0100 Subject: Fix Issue #596: Provide correct content-type Provide the proper content-type Quote filename due to Firefox bug https://bugzilla.mozilla.org/show_bug.cgi?id=221028 --- service/pixelated/resources/attachments_resource.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'service/pixelated/resources/attachments_resource.py') diff --git a/service/pixelated/resources/attachments_resource.py b/service/pixelated/resources/attachments_resource.py index 249d268a..086f6e4e 100644 --- a/service/pixelated/resources/attachments_resource.py +++ b/service/pixelated/resources/attachments_resource.py @@ -46,8 +46,9 @@ class AttachmentResource(Resource): encoding = request.args.get('encoding', [None])[0] filename = request.args.get('filename', [self.attachment_id])[0] - request.setHeader(b'Content-Type', b'application/force-download') - request.setHeader(b'Content-Disposition', bytes('attachment; filename=' + filename)) + content_type = request.args.get('content_type', ['application/octet-stream'])[0] + request.setHeader(b'Content-Type', content_type) + request.setHeader(b'Content-Disposition', bytes('attachment; filename="' + filename + '"')) d = self._send_attachment(encoding, filename, request) d.addErrback(error_handler) -- cgit v1.2.3