Skip to content

Commit

Permalink
allow download of big files via s3 too
Browse files Browse the repository at this point in the history
  • Loading branch information
orangewolf committed Jun 21, 2024
1 parent 4fc057d commit 56bbaf1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/controllers/hyrax/downloads_controller_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ module Hyrax
module DownloadsControllerDecorator
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:', ''))
s3_object = if asset.respond_to?(:s3_only) && asset.s3_only
Aws::S3::Object.new(ENV['AWS_BUCKET'], asset.s3_only)
else
Aws::S3::Object.new(ENV['AWS_BUCKET'], file.digest.first.to_s.gsub('urn:sha1:', ''))
end
if s3_object.exists?
redirect_to s3_object.presigned_url(
:get,
Expand Down

0 comments on commit 56bbaf1

Please sign in to comment.