diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2017-09-06 15:58:26 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2017-09-06 15:58:26 +0000 |
commit | 29a34b3c283634192d6bf0e4200296569deb18ba (patch) | |
tree | b0eae8c966ae184ab2a561d8674cc5df4dbde3b6 /app/controllers | |
parent | 8a2aab447a6d5bb540d3c514f6aac41f5e47ee29 (diff) | |
parent | ec7a12da818898b278a3e47a9b96ccebafbe5b4c (diff) | |
download | gitlab-ce-29a34b3c283634192d6bf0e4200296569deb18ba.tar.gz |
Merge branch 'feature/gb/download-single-job-artifact-using-api' into 'master'
Add API endpoint for downloading a single job artifact
Closes #37196
See merge request !14027
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects/artifacts_controller.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/app/controllers/projects/artifacts_controller.rb b/app/controllers/projects/artifacts_controller.rb index f637a9a803b..eb010923466 100644 --- a/app/controllers/projects/artifacts_controller.rb +++ b/app/controllers/projects/artifacts_controller.rb @@ -7,7 +7,7 @@ class Projects::ArtifactsController < Projects::ApplicationController before_action :authorize_update_build!, only: [:keep] before_action :extract_ref_name_and_path before_action :validate_artifacts! - before_action :set_path_and_entry, only: [:file, :raw] + before_action :entry, only: [:file] def download if artifacts_file.file_storage? @@ -41,7 +41,10 @@ class Projects::ArtifactsController < Projects::ApplicationController end def raw - send_artifacts_entry(build, @entry) + path = Gitlab::Ci::Build::Artifacts::Path + .new(params[:path]) + + send_artifacts_entry(build, path) end def keep @@ -93,9 +96,8 @@ class Projects::ArtifactsController < Projects::ApplicationController @artifacts_file ||= build.artifacts_file end - def set_path_and_entry - @path = params[:path] - @entry = build.artifacts_metadata_entry(@path) + def entry + @entry = build.artifacts_metadata_entry(params[:path]) render_404 unless @entry.exists? end |