diff options
author | Felix Hammerl <fhammerl@thoughtworks.com> | 2016-02-10 17:27:15 +0100 |
---|---|---|
committer | Felix Hammerl <fhammerl@thoughtworks.com> | 2016-02-10 17:29:58 +0100 |
commit | dac74cc8cabdc5e3ad0e90fc9aff3b6beedc964f (patch) | |
tree | 0adfef86e8ecebf18608d2c9aa7c995efe5f8f7f /service/pixelated/resources/attachments_resource.py | |
parent | cf6adf149d2356400e611b019353f431a032d88e (diff) |
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
Diffstat (limited to 'service/pixelated/resources/attachments_resource.py')
-rw-r--r-- | service/pixelated/resources/attachments_resource.py | 5 |
1 files changed, 3 insertions, 2 deletions
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) |