summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2018-02-22 14:51:20 +0000
committerDouwe Maan <douwe@gitlab.com>2018-02-22 14:51:20 +0000
commite28a4a5b6cdd634cde58ef8d86aefdb5c26839ea (patch)
tree190bd0084de09535c72613974a5349dd21bd38c7 /lib
parent700e2a165bdfd7906f6f4bad5495c890f814f277 (diff)
parentcdf3ae04f84abe039b79ab31192bb7c462bf7ce5 (diff)
downloadgitlab-ce-e28a4a5b6cdd634cde58ef8d86aefdb5c26839ea.tar.gz
Merge branch '42332-actionview-template-error-366-524-out-of-range' into 'master'
Resolve "ActionView::Template::Error: 366..524 out of range" Closes #42332 See merge request gitlab-org/gitlab-ce!17262
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/diff/highlight.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/gitlab/diff/highlight.rb b/lib/gitlab/diff/highlight.rb
index 0f897e6316c..269016daac2 100644
--- a/lib/gitlab/diff/highlight.rb
+++ b/lib/gitlab/diff/highlight.rb
@@ -27,7 +27,17 @@ module Gitlab
rich_line = highlight_line(diff_line) || diff_line.text
if line_inline_diffs = inline_diffs[i]
- rich_line = InlineDiffMarker.new(diff_line.text, rich_line).mark(line_inline_diffs)
+ begin
+ rich_line = InlineDiffMarker.new(diff_line.text, rich_line).mark(line_inline_diffs)
+ # This should only happen when the encoding of the diff doesn't
+ # match the blob, which is a bug. But we shouldn't fail to render
+ # completely in that case, even though we want to report the error.
+ rescue RangeError => e
+ if Gitlab::Sentry.enabled?
+ Gitlab::Sentry.context
+ Raven.capture_exception(e)
+ end
+ end
end
diff_line.text = rich_line