Commit f5d7a617 authored by Valery Sizov's avatar Valery Sizov

Fixes ActionView::Template::Error: undefined method `text?` for nil:NilClass

parent 2394afe4
---
title: 'Fixes "ActionView::Template::Error: undefined method `text?` for nil:NilClass"
on MR pages'
merge_request:
author:
......@@ -61,7 +61,7 @@ module Gitlab
end
def cacheable?(diff_file)
@merge_request_diff.present? && diff_file.blob.text?
@merge_request_diff.present? && diff_file.blob && diff_file.blob.text?
end
def cache_key
......
......@@ -10,4 +10,12 @@ describe Gitlab::Diff::FileCollection::MergeRequestDiff do
described_class.new(merge_request.merge_request_diff, diff_options: nil).diff_files
end
it 'does not hightlight file if blob is not accessable' do
allow_any_instance_of(Gitlab::Diff::File).to receive(:blob).and_return(nil)
expect_any_instance_of(Gitlab::Diff::File).not_to receive(:highlighted_diff_lines)
described_class.new(merge_request.merge_request_diff, diff_options: nil).diff_files
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