From 22d1ec661d478b46e4e667316303803973f8d5fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= Date: Tue, 16 Oct 2018 13:01:48 +0000 Subject: [PATCH] Disable artifact validation for download action --- app/controllers/projects/artifacts_controller.rb | 4 ++-- app/controllers/projects/build_artifacts_controller.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/projects/artifacts_controller.rb b/app/controllers/projects/artifacts_controller.rb index d0f59aa8162..312e256ea6c 100644 --- a/app/controllers/projects/artifacts_controller.rb +++ b/app/controllers/projects/artifacts_controller.rb @@ -10,7 +10,7 @@ class Projects::ArtifactsController < Projects::ApplicationController before_action :authorize_update_build!, only: [:keep] before_action :extract_ref_name_and_path before_action :set_request_format, only: [:file] - before_action :validate_artifacts! + before_action :validate_artifacts!, except: [:download] before_action :entry, only: [:file] def download @@ -102,7 +102,7 @@ class Projects::ArtifactsController < Projects::ApplicationController # rubocop: enable CodeReuse/ActiveRecord def artifacts_file - @artifacts_file ||= build.artifacts_file_for_type(params[:file_type] || :archive) + @artifacts_file ||= build&.artifacts_file_for_type(params[:file_type] || :archive) end def entry diff --git a/app/controllers/projects/build_artifacts_controller.rb b/app/controllers/projects/build_artifacts_controller.rb index 46449a4aae9..7d4d566499c 100644 --- a/app/controllers/projects/build_artifacts_controller.rb +++ b/app/controllers/projects/build_artifacts_controller.rb @@ -6,10 +6,10 @@ class Projects::BuildArtifactsController < Projects::ApplicationController before_action :authorize_read_build! before_action :extract_ref_name_and_path - before_action :validate_artifacts! + before_action :validate_artifacts!, except: [:download] def download - redirect_to download_project_job_artifacts_path(project, job) + redirect_to download_project_job_artifacts_path(project, job, params: request.query_parameters) end def browse