debian-mirror-gitlab/app/uploaders/object_storage/s3.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
433 B
Ruby
Raw Permalink Normal View History

2023-04-23 21:23:45 +05:30
# frozen_string_literal: true
module ObjectStorage
module S3
def self.signed_head_url(file)
fog_storage = ::Fog::Storage.new(file.fog_credentials)
fog_dir = fog_storage.directories.new(key: file.fog_directory)
fog_file = fog_dir.files.new(key: file.path)
expire_at = ::Fog::Time.now + file.fog_authenticated_url_expiration
fog_file.collection.head_url(fog_file.key, expire_at)
end
end
end