Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-06-15 18:09:20 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-06-15 18:09:20 +0300
commit9440c17f554424cc77aff8afadc61adbe23524d1 (patch)
treebc2b4213d845e5fd6d43eb71d21cfce28c81e440 /lib/api/helpers.rb
parent3e0c035fe3a10436be36b4e22a4986479821b8e4 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r--lib/api/helpers.rb18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index e31748a993e..fc1037131d8 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -570,11 +570,19 @@ module API
end
end
+ def log_artifact_size(file)
+ Gitlab::ApplicationContext.push(artifact: file.model)
+ end
+
+ def present_artifacts_file!(file, **args)
+ log_artifact_size(file) if file
+
+ present_carrierwave_file!(file, **args)
+ end
+
def present_carrierwave_file!(file, supports_direct_download: true)
return not_found! unless file&.exists?
- log_artifact_size(file) if file.is_a?(JobArtifactUploader)
-
if file.file_storage?
present_disk_file!(file.path, file.filename)
elsif supports_direct_download && file.class.direct_download_enabled?
@@ -725,7 +733,6 @@ module API
# Deprecated. Use `send_artifacts_entry` instead.
def legacy_send_artifacts_entry(file, entry)
header(*Gitlab::Workhorse.send_artifacts_entry(file, entry))
- log_artifact_size(file)
body ''
end
@@ -733,15 +740,10 @@ module API
def send_artifacts_entry(file, entry)
header(*Gitlab::Workhorse.send_artifacts_entry(file, entry))
header(*Gitlab::Workhorse.detect_content_type)
- log_artifact_size(file)
body ''
end
- def log_artifact_size(file)
- Gitlab::ApplicationContext.push(artifact: file.model)
- end
-
# The Grape Error Middleware only has access to `env` but not `params` nor
# `request`. We workaround this by defining methods that returns the right
# values.