Skip to content

Commit

Permalink
Merge branch 's3_direct_downloads'
Browse files Browse the repository at this point in the history
  • Loading branch information
orangewolf committed Sep 23, 2023
2 parents a2587c3 + 8f783aa commit b3a75c0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/controllers/hyrax/downloads_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# OVERRIDE Hyrax 2.9.6 for IRUS Analytics

require 'aws-sdk-s3'

module Hyrax
class DownloadsController < ApplicationController
include Hydra::Controller::DownloadBehavior
Expand Down Expand Up @@ -40,7 +42,7 @@ def item_identifier_for_irus_analytics
def send_file_contents
if ENV['S3_DOWNLOADS']
s3_object = Aws::S3::Object.new(ENV['AWS_BUCKET'], file.digest.first.to_s.gsub('urn:sha1:', ''))
redirect_to s3_object.presigned_url(:get, expires_in: 300, response_content_disposition: "attachment\; filename=#{file.original_name}")
redirect_to s3_object.presigned_url(:get, expires_in: 3600, response_content_disposition: "attachment\; filename=#{file.original_name}")
else
self.status = 200
prepare_file_headers
Expand Down

0 comments on commit b3a75c0

Please sign in to comment.