Skip to content

Commit

Permalink
Download file from shared file location (#596)
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorcorrea authored Mar 22, 2024
1 parent 760e541 commit 8975075
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def file_list_download
# TODO: handle error
redirect_to "/"
else
filename = "#{Dir.pwd}/public/#{job_id}.csv"
filename = shared_file_location("#{job_id}.csv")
send_data File.read(filename), type: "text/plain", filename: "filelist.csv", disposition: "attachment"
end
end
Expand All @@ -215,4 +215,10 @@ def project
def eligible_editor?
return true if current_user.eligible_sponsor? or current_user.eligible_manager?
end

def shared_file_location(filename)
raise "Shared location is not configured" if Rails.configuration.mediaflux["shared_files_location"].blank?
location = Pathname.new(Rails.configuration.mediaflux["shared_files_location"])
location.join(filename).to_s
end
end

0 comments on commit 8975075

Please sign in to comment.