diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-01-12 11:02:15 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-01-14 12:48:16 +0100 |
commit | 487b0a026f9efe2d8214c19a7b95b391708ba3f4 (patch) | |
tree | de1454b660d4478af5dafdfcfd027c787c6ae0c3 /app/controllers/projects/artifacts_controller.rb | |
parent | 2be76355caa579d444c8e3c0d25563eb9778bfb2 (diff) | |
download | gitlab-ce-487b0a026f9efe2d8214c19a7b95b391708ba3f4.tar.gz |
Improvements, readability for artifacts browser
Diffstat (limited to 'app/controllers/projects/artifacts_controller.rb')
-rw-r--r-- | app/controllers/projects/artifacts_controller.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/app/controllers/projects/artifacts_controller.rb b/app/controllers/projects/artifacts_controller.rb index a1f82ddd9c5..00daac0cb30 100644 --- a/app/controllers/projects/artifacts_controller.rb +++ b/app/controllers/projects/artifacts_controller.rb @@ -1,6 +1,6 @@ class Projects::ArtifactsController < Projects::ApplicationController layout 'project' - before_action :authorize_download_build_artifacts! + before_action :authorize_read_build_artifacts! def download unless artifacts_file.file_storage? @@ -24,11 +24,11 @@ class Projects::ArtifactsController < Projects::ApplicationController end def file - file = build.artifacts_metadata_path(params[:path]) + file_path = build.artifacts_metadata_path(params[:path]) - if file.exists? - render json: { repository: build.artifacts_file.path, - path: Base64.encode64(file.path) } + if file_path.exists? + render json: { archive: build.artifacts_file.path, + path: Base64.encode64(file_path.path) } else render json: {}, status: 404 end @@ -44,8 +44,8 @@ class Projects::ArtifactsController < Projects::ApplicationController @artifacts_file ||= build.artifacts_file end - def authorize_download_build_artifacts! - unless can?(current_user, :download_build_artifacts, @project) + def authorize_read_build_artifacts! + unless can?(current_user, :read_build_artifacts, @project) if current_user.nil? return authenticate_user! else |