Merge branch '25761-fix-blame-500' into 'master'

Fix 500 error for invalid path when visiting blame page

Closes #25761

See merge request !8145
This commit is contained in:
Sean McGivern 2016-12-19 17:44:28 +00:00
commit 40a6a077fd
3 changed files with 12 additions and 0 deletions

View File

@ -8,6 +8,9 @@ class Projects::BlameController < Projects::ApplicationController
def show
@blob = @repository.blob_at(@commit.id, @path)
return render_404 unless @blob
@blame_groups = Gitlab::Blame.new(@blob, @commit).groups
end
end

View File

@ -0,0 +1,4 @@
---
title: Fix blame 500 error on invalid path.
merge_request: 25761
author: Jeff Stubler

View File

@ -25,5 +25,10 @@ describe Projects::BlameController do
let(:id) { 'master/files/ruby/popen.rb' }
it { is_expected.to respond_with(:success) }
end
context "invalid file" do
let(:id) { 'master/files/ruby/missing_file.rb'}
it { expect(response).to have_http_status(404) }
end
end
end