diff options
Diffstat (limited to 'app/services/dependency_proxy/download_blob_service.rb')
-rw-r--r-- | app/services/dependency_proxy/download_blob_service.rb | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/app/services/dependency_proxy/download_blob_service.rb b/app/services/dependency_proxy/download_blob_service.rb deleted file mode 100644 index b3548c8a126..00000000000 --- a/app/services/dependency_proxy/download_blob_service.rb +++ /dev/null @@ -1,38 +0,0 @@ -# frozen_string_literal: true - -module DependencyProxy - class DownloadBlobService < DependencyProxy::BaseService - def initialize(image, blob_sha, token) - @image = image - @blob_sha = blob_sha - @token = token - @temp_file = Tempfile.new - end - - def execute - File.open(@temp_file.path, "wb") do |file| - Gitlab::HTTP.get(blob_url, headers: auth_headers, stream_body: true) do |fragment| - if [301, 302, 307].include?(fragment.code) - # do nothing - elsif fragment.code == 200 - file.write(fragment) - else - raise DownloadError.new('Non-success response code on downloading blob fragment', fragment.code) - end - end - end - - success(file: @temp_file) - rescue DownloadError => exception - error(exception.message, exception.http_status) - rescue Timeout::Error => exception - error(exception.message, 599) - end - - private - - def blob_url - registry.blob_url(@image, @blob_sha) - end - end -end |