Respond to proper format for build badge request

This commit is contained in:
Grzegorz Bizon 2016-02-08 08:57:09 +01:00
parent 52352dccc3
commit 479d412e09
1 changed files with 8 additions and 2 deletions

View File

@ -62,8 +62,14 @@ class Projects::BuildsController < Projects::ApplicationController
def badge
project = Project.find_with_namespace("#{params[:namespace_id]}/#{params[:project_id]}")
image = Ci::ImageForBuildService.new.execute(project, ref: params[:ref])
send_file(image.path, filename: image.name, disposition: 'inline', type: 'image/svg+xml')
respond_to do |format|
format.html { render_404 }
format.svg do
image = Ci::ImageForBuildService.new.execute(project, ref: params[:ref])
send_file(image.path, filename: image.name, disposition: 'inline', type: 'image/svg+xml')
end
end
end
private