Commit 26c8e0b3 authored by Jeff Stubler's avatar Jeff Stubler

Fix 500 error for invalid path when visiting blame page

Closes #25761.
parent 546fa165
...@@ -8,6 +8,9 @@ class Projects::BlameController < Projects::ApplicationController ...@@ -8,6 +8,9 @@ class Projects::BlameController < Projects::ApplicationController
def show def show
@blob = @repository.blob_at(@commit.id, @path) @blob = @repository.blob_at(@commit.id, @path)
return render_404 unless @blob
@blame_groups = Gitlab::Blame.new(@blob, @commit).groups @blame_groups = Gitlab::Blame.new(@blob, @commit).groups
end end
end end
---
title: Fix blame 500 error on invalid path.
merge_request: 25761
author: Jeff Stubler
...@@ -25,5 +25,10 @@ describe Projects::BlameController do ...@@ -25,5 +25,10 @@ describe Projects::BlameController do
let(:id) { 'master/files/ruby/popen.rb' } let(:id) { 'master/files/ruby/popen.rb' }
it { is_expected.to respond_with(:success) } it { is_expected.to respond_with(:success) }
end end
context "invalid file" do
let(:id) { 'master/files/ruby/missing_file.rb'}
it { expect(response).to have_http_status(404) }
end
end end
end 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