diff --git a/app/controllers/projects/artifacts_controller.rb b/app/controllers/projects/artifacts_controller.rb index c1449dfd3d3e716268234f3f48e31dc70ecd25fe..c3dcde38d096461dac8947c11decb1453799615c 100644 --- a/app/controllers/projects/artifacts_controller.rb +++ b/app/controllers/projects/artifacts_controller.rb @@ -4,6 +4,7 @@ class Projects::ArtifactsController < Projects::ApplicationController include ExtractsPath include RendersBlob include SendFileUpload + include Gitlab::Ci::Artifacts::Logger urgency :low, [:browse, :file, :latest_succeeded] @@ -41,6 +42,7 @@ def destroy def download return render_404 unless artifacts_file + log_artifacts_filesize(artifacts_file.model) send_upload(artifacts_file, attachment: artifacts_file.filename, proxy: params[:proxy]) end diff --git a/spec/controllers/projects/artifacts_controller_spec.rb b/spec/controllers/projects/artifacts_controller_spec.rb index 8579d763ab0126355fa31b713652e59db020509c..50d0f5a65c62844e6d810ea086368d62a3af42e3 100644 --- a/spec/controllers/projects/artifacts_controller_spec.rb +++ b/spec/controllers/projects/artifacts_controller_spec.rb @@ -158,9 +158,12 @@ def download_artifact(extra_params = {}) before do stub_artifacts_object_storage(cdn: cdn_config) create(:ci_job_artifact, :remote_store, :codequality, job: job) + allow(Gitlab::ApplicationContext).to receive(:push).and_call_original end it 'sends the codequality report' do + expect(Gitlab::ApplicationContext).to receive(:push).with(artifact: an_instance_of(Ci::JobArtifact)).and_call_original + expect(controller).to receive(:redirect_to).and_call_original download_artifact(file_type: file_type) @@ -185,12 +188,12 @@ def download_artifact(extra_params = {}) end before do - allow(Gitlab::ApplicationContext).to receive(:push).and_call_original request.env['action_dispatch.remote_ip'] = '18.245.0.42' end context 'with use_cdn_with_job_artifacts_ui_downloads enabled' do it 'redirects to a Google CDN request' do + expect(Gitlab::ApplicationContext).to receive(:push).with(artifact: an_instance_of(Ci::JobArtifact)).and_call_original expect(Gitlab::ApplicationContext).to receive(:push).with(artifact_used_cdn: true).and_call_original download_artifact(file_type: file_type)