diff --git a/lib/api/builds.rb b/lib/api/builds.rb
index 505ba1a66fed0f0c9b343c5e747aad95bee57444..5c14444f91a3c0410817c19197db0c3d07d7d958 100644
--- a/lib/api/builds.rb
+++ b/lib/api/builds.rb
@@ -69,9 +69,8 @@ module API
         authorize_read_builds!
 
         build = get_build!(params[:build_id])
-        artifacts_file = build.artifacts_file
 
-        present_artifact!(artifacts_file)
+        present_artifact!(build.artifacts_file)
       end
 
       # Download the artifacts file from ref_name and build_name
@@ -90,8 +89,7 @@ module API
         latest_build = builds.success.latest.first
 
         if latest_build
-          redirect(
-            "/projects/#{user_project.id}/builds/#{latest_build.id}/artifacts")
+          present_artifact!(latest_build.artifacts_file)
         else
           not_found!
         end
diff --git a/spec/requests/api/artifacts_spec.rb b/spec/requests/api/artifacts_spec.rb
index f1461f7bc535b3ba9c689399d9e556e84bfd5493..56d0965b0be72814c57c5d927e7e3e37b01e9d77 100644
--- a/spec/requests/api/artifacts_spec.rb
+++ b/spec/requests/api/artifacts_spec.rb
@@ -31,10 +31,15 @@ describe API::API, api: true do
       it_behaves_like 'artifacts from ref with 404'
     end
 
-    context '302' do
+    context '200' do
       def verify
-        expect(response).to redirect_to(
-          "/projects/#{project.id}/builds/#{build.id}/artifacts")
+        download_headers =
+          { 'Content-Transfer-Encoding' => 'binary',
+            'Content-Disposition' =>
+              "attachment; filename=#{build.artifacts_file.filename}" }
+
+        expect(response).to have_http_status(200)
+        expect(response.headers).to include(download_headers)
       end
 
       it_behaves_like 'artifacts from ref with 302'