3
4
5
6
7
8
9
10
11
12
13
14
15
|
# File 'app/controllers/work_downloader_controller.rb', line 3
def download
work = Work.find(params[:id])
if current_user && work.editable_by?(current_user)
file_name = params[:filename]
mode = work.approved? ? "postcuration" : "precuration"
service = S3QueryService.new(work, mode)
uri = service.file_url(file_name)
redirect_to uri
else
Honeybadger.notify("Can not download work: #{work.id} is not editable by #{current_user.uid}")
redirect_to root_path, notice: I18n.t("works.download.privs")
end
end
|