Skip to content

Commit

Permalink
Synced from resource view override.
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkCalvert committed Nov 1, 2024
1 parent db4268f commit 5f8e887
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ckanext/fortify/blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import ckan.lib.mailer as mailer
import ckan.lib.navl.dictization_functions as dictization_functions
import ckan.lib.uploader as uploader
from ckan.lib import signals
import flask

from ckan.views.user import PerformResetView
Expand Down Expand Up @@ -156,7 +157,11 @@ def download(package_type, id, resource_id, filename=None):
# This will set the header headers.add('Content-Disposition', 'attachment', filename=attachment_filename)
return flask.send_file(filepath, mimetype=upload.mimetype, as_attachment=True, attachment_filename=filename)
else:
return flask.send_file(filepath)
resp = flask.send_file(filepath, download_name=filename)
if rsc.get('mimetype'):
resp.headers['Content-Type'] = rsc['mimetype']
signals.resource_download.send(resource_id)
return resp
# Fortify updates end
elif u'url' not in rsc:
return abort(404, _(u'No download is available'))
Expand Down

0 comments on commit 5f8e887

Please sign in to comment.