diff --git a/apimail/views.py b/apimail/views.py index cd54b1cb906b17da5aeca84bdeadf134f17cc4ff..396a0aac1a58be3762c583ad59b6e67c12bf5e8c 100644 --- a/apimail/views.py +++ b/apimail/views.py @@ -15,10 +15,10 @@ def attachment_file(request, uuid): Return an attachment file. """ att = get_object_or_404(AttachmentFile, uuid=uuid) - content_type, encoding = mimetypes.guess_type(att.attachment_file.path) + content_type, encoding = mimetypes.guess_type(att.file.path) content_type = content_type or 'application/octet-stream' - response = HttpResponse(att.attachment_file.read(), content_type=content_type) + response = HttpResponse(att.file.read(), content_type=content_type) response['Content-Disposition'] = ( - 'filename=%s' % att.attachment_file.name.rpartition('/')[2]) + 'filename=%s' % att.file.name.rpartition('/')[2]) response["Content-Encoding"] = encoding return response