From 533184e804a666c95e350e4804e04e2f08d0c58b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Tue, 19 Aug 2014 18:40:17 +0200 Subject: [PATCH] Fixed bug #726: Now attachments are in new window but inline --- taiga/projects/attachments/api.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/taiga/projects/attachments/api.py b/taiga/projects/attachments/api.py index 31047506..d7d3eb3a 100644 --- a/taiga/projects/attachments/api.py +++ b/taiga/projects/attachments/api.py @@ -16,6 +16,8 @@ import os import hashlib +import mimetypes +mimetypes.init() from django.utils.translation import ugettext as _ from django.contrib.contenttypes.models import ContentType @@ -109,6 +111,7 @@ class RawAttachmentView(generics.RetrieveAPIView): response['X-Accel-Redirect'] = "/{filepath}".format(filepath=name) response['Content-Disposition'] = 'attachment;filename={filename}'.format( filename=os.path.basename(name)) + response['Content-Type'] = mimetypes.guess_type(attachment.url) return response