diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-14 21:12:38 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-14 21:12:38 +0300 |
commit | 283c7bb302510ed1fc55f0d333c484ce7fa781fd (patch) | |
tree | adbb03e34cc91f339395f6417502c075ee84b8bb /lib/api/helpers.rb | |
parent | a2b7b398c7855bccee5d2f0f9a021b2efea0838e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r-- | lib/api/helpers.rb | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 197bd420295..aadcbe38b15 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -608,7 +608,7 @@ module API if file.file_storage? present_disk_file!(file.path, file.filename) elsif supports_direct_download && file.class.direct_download_enabled? - return redirect(signed_head_url(file)) if head_request_on_aws_file?(file) + return redirect(ObjectStorage::S3.signed_head_url(file)) if request.head? && file.fog_credentials[:provider] == 'AWS' redirect(cdn_fronted_url(file)) else @@ -701,19 +701,6 @@ module API private - def head_request_on_aws_file?(file) - request.head? && file.fog_credentials[:provider] == 'AWS' - end - - def 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 - # rubocop:disable Gitlab/ModuleWithInstanceVariables def initial_current_user return @initial_current_user if defined?(@initial_current_user) |