diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-02-22 14:51:20 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-02-22 14:51:20 +0000 |
commit | e28a4a5b6cdd634cde58ef8d86aefdb5c26839ea (patch) | |
tree | 190bd0084de09535c72613974a5349dd21bd38c7 /lib | |
parent | 700e2a165bdfd7906f6f4bad5495c890f814f277 (diff) | |
parent | cdf3ae04f84abe039b79ab31192bb7c462bf7ce5 (diff) | |
download | gitlab-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.rb | 12 |
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 |