summaryrefslogtreecommitdiff
path: root/lib/api/helpers.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2018-02-06 15:39:20 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2018-02-28 20:58:56 +0100
commitb14c484bb1d174c7c355de2258be1a4414b2cf78 (patch)
treee7cf84f28c964580b74f791d235987948f3cc4a8 /lib/api/helpers.rb
parenta7dae52e9d27adde427ef8aa066c0761071a3cd9 (diff)
downloadgitlab-ce-b14c484bb1d174c7c355de2258be1a4414b2cf78.tar.gz
Merge branch 'use-send-url-for-incompatible-runners' into 'master'
Support SendURL for performing indirect download of artifacts if clients does… See merge request gitlab-org/gitlab-ee!4401
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r--lib/api/helpers.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index cc81e4d3595..d4ca945873c 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -418,13 +418,17 @@ module API
end
end
- def present_artifacts!(artifacts_file)
+ def present_artifacts!(artifacts_file, direct_download: true)
return not_found! unless artifacts_file.exists?
if artifacts_file.file_storage?
present_file!(artifacts_file.path, artifacts_file.filename)
- else
+ elsif direct_download
redirect(artifacts_file.url)
+ else
+ header(*Gitlab::Workhorse.send_url(artifacts_file.url))
+ status :ok
+ body
end
end