diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-02-05 14:42:01 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-02-11 10:29:14 +0100 |
commit | 442a49db2bc5e3f6cea827879fa4f5c532a5f6f1 (patch) | |
tree | e757605148341535d92d52da22ab46996702b8e4 /app | |
parent | 28c4c949a5965f0328bb94d7ab1a318c9e226ff7 (diff) | |
download | gitlab-ce-442a49db2bc5e3f6cea827879fa4f5c532a5f6f1.tar.gz |
Skip authentication when requesting commit status badge
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects/commit_controller.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/controllers/projects/commit_controller.rb b/app/controllers/projects/commit_controller.rb index 36fef1740e2..493cd332d9f 100644 --- a/app/controllers/projects/commit_controller.rb +++ b/app/controllers/projects/commit_controller.rb @@ -10,6 +10,11 @@ class Projects::CommitController < Projects::ApplicationController before_action :commit before_action :define_show_vars, only: [:show, :builds] + # Skip authentication for status badge only + skip_before_action :authenticate_user!, :reject_blocked!, :project, + :repository, :require_non_empty_project, :authorize_download_code!, + :commit, only: [:badge] + def show return git_not_found! unless @commit @@ -58,7 +63,8 @@ class Projects::CommitController < Projects::ApplicationController end def badge - image = Ci::ImageForBuildService.new.execute(@project, ref: params[:id]) + project = Project.find_with_namespace("#{params[:namespace_id]}/#{params[:project_id]}") + image = Ci::ImageForBuildService.new.execute(project, ref: params[:id]) send_file(image.path, filename: image.name, disposition: 'inline', type: 'image/svg+xml') end |