GitLab steht wegen Wartungsarbeiten am Montag, den 10. Mai, zwischen 17:00 und 19:00 Uhr nicht zur Verfügung.

Commit 442a49db authored by Grzegorz Bizon's avatar Grzegorz Bizon

Skip authentication when requesting commit status badge

parent 28c4c949
......@@ -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 @@ def branches
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
......
......@@ -498,7 +498,7 @@
'/status/*id/badge',
to: 'commit#badge',
constraints: { format: /png/ },
as: :commit_badge
as: :build_badge
)
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment