SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 9ddd7fa3 authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Quick debug

parent d0362522
No related branches found
No related tags found
No related merge requests found
...@@ -15,10 +15,10 @@ def attachment_file(request, uuid): ...@@ -15,10 +15,10 @@ def attachment_file(request, uuid):
Return an attachment file. Return an attachment file.
""" """
att = get_object_or_404(AttachmentFile, uuid=uuid) 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' 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'] = ( response['Content-Disposition'] = (
'filename=%s' % att.attachment_file.name.rpartition('/')[2]) 'filename=%s' % att.file.name.rpartition('/')[2])
response["Content-Encoding"] = encoding response["Content-Encoding"] = encoding
return response return response
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment