diff options
Diffstat (limited to 'app/models/merge_request_diff_file.rb')
-rw-r--r-- | app/models/merge_request_diff_file.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/models/merge_request_diff_file.rb b/app/models/merge_request_diff_file.rb index f3f64971426..f7648937c1d 100644 --- a/app/models/merge_request_diff_file.rb +++ b/app/models/merge_request_diff_file.rb @@ -15,9 +15,11 @@ class MergeRequestDiffFile < ApplicationRecord end def utf8_diff - return '' if diff.blank? + fetched_diff = diff - encode_utf8(diff) if diff.respond_to?(:encoding) + return '' if fetched_diff.blank? + + encode_utf8(fetched_diff) if fetched_diff.respond_to?(:encoding) end def diff |