Fixed bug #726: Now attachments are in new window but inline

remotes/origin/enhancement/email-actions
Jesús Espino 2014-08-19 18:40:17 +02:00
parent 7dcf1b768d
commit 533184e804
1 changed files with 3 additions and 0 deletions

View File

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