summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-01-11 10:01:18 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-01-14 12:48:16 +0100
commite9c2628220ed3a9d82cba31e7c9d2654c20235c8 (patch)
tree6ccfb6fb3bad94a97856e7e07652b449b3153996
parent09a4a5aff8c53dd5930044ddbb285a95ef177d8a (diff)
downloadgitlab-ce-e9c2628220ed3a9d82cba31e7c9d2654c20235c8.tar.gz
Check if file exists in metadata in download action
-rw-r--r--app/controllers/projects/artifacts_controller.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/app/controllers/projects/artifacts_controller.rb b/app/controllers/projects/artifacts_controller.rb
index f88d866febc..a1f82ddd9c5 100644
--- a/app/controllers/projects/artifacts_controller.rb
+++ b/app/controllers/projects/artifacts_controller.rb
@@ -24,9 +24,14 @@ class Projects::ArtifactsController < Projects::ApplicationController
end
def file
- # TODO, check if file exists in metadata
- render json: { repository: build.artifacts_file.path,
- path: Base64.encode64(params[:path].to_s) }
+ file = build.artifacts_metadata_path(params[:path])
+
+ if file.exists?
+ render json: { repository: build.artifacts_file.path,
+ path: Base64.encode64(file.path) }
+ else
+ render json: {}, status: 404
+ end
end
private