diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-20 14:18:08 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-20 14:18:08 +0300 |
commit | 5afcbe03ead9ada87621888a31a62652b10a7e4f (patch) | |
tree | 9918b67a0d0f0bafa6542e839a8be37adf73102d /lib/api/maven_packages.rb | |
parent | c97c0201564848c1f53226fe19d71fdcc472f7d0 (diff) |
Add latest changes from gitlab-org/gitlab@16-4-stable-eev16.4.0-rc42
Diffstat (limited to 'lib/api/maven_packages.rb')
-rw-r--r-- | lib/api/maven_packages.rb | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/lib/api/maven_packages.rb b/lib/api/maven_packages.rb index eccc55ed158..517de98a148 100644 --- a/lib/api/maven_packages.rb +++ b/lib/api/maven_packages.rb @@ -34,18 +34,6 @@ module API .exists? end - def extract_format(file_name) - name, _, format = file_name.rpartition('.') - - if %w(md5 sha1).include?(format) - unprocessable_entity! if Gitlab::FIPS.enabled? && format == 'md5' - - [name, format] - else - [file_name, format] - end - end - # The sha verification done by the maven api is between: # - the sha256 set by workhorse helpers # - the sha256 of the sha1 of the uploaded package file @@ -69,46 +57,6 @@ module API format == 'jar' end - def present_carrierwave_file_with_head_support!(package_file, supports_direct_download: true) - package_file.package.touch_last_downloaded_at - file = package_file.file - - if head_request_on_aws_file?(file, supports_direct_download) && !file.file_storage? - return redirect(signed_head_url(file)) - end - - present_carrierwave_file!(file, supports_direct_download: supports_direct_download) - 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 - - def head_request_on_aws_file?(file, supports_direct_download) - Gitlab.config.packages.object_store.enabled && - supports_direct_download && - file.class.direct_download_enabled? && - request.head? && - file.fog_credentials[:provider] == 'AWS' - end - - def fetch_package(file_name:, project: nil, group: nil) - order_by_package_file = file_name.include?(::Packages::Maven::Metadata.filename) && - !params[:path].include?(::Packages::Maven::FindOrCreatePackageService::SNAPSHOT_TERM) - - ::Packages::Maven::PackageFinder.new( - current_user, - project || group, - path: params[:path], - order_by_package_file: order_by_package_file - ).execute - end - def find_and_present_package_file(package, file_name, format, params) project = package&.project package_file = nil |