SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit f4691ec7 authored by George Katsikas's avatar George Katsikas :goat:
Browse files

fix deletion of mimetypes import

parent f8dbc8b4
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,7 @@ __license__ = "AGPL v3" ...@@ -4,6 +4,7 @@ __license__ = "AGPL v3"
import datetime import datetime
from itertools import accumulate from itertools import accumulate
import mimetypes
from dal import autocomplete from dal import autocomplete
from django.db.models import Q from django.db.models import Q
...@@ -542,8 +543,9 @@ def subsidy_attachment(request, subsidy_id, attachment_id): ...@@ -542,8 +543,9 @@ def subsidy_attachment(request, subsidy_id, attachment_id):
content_type, encoding = mimetypes.guess_type(attachment.attachment.path) content_type, encoding = mimetypes.guess_type(attachment.attachment.path)
content_type = content_type or "application/octet-stream" content_type = content_type or "application/octet-stream"
response = HttpResponse(attachment.attachment.read(), content_type=content_type) response = HttpResponse(attachment.attachment.read(), content_type=content_type)
response["Content-Encoding"] = encoding if encoding:
response["Content-Disposition"] = "filename=%s" % attachment.attachment.name response["Content-Encoding"] = encoding
response["Content-Disposition"] = "filename=%s" % attachment.attachment.name
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