diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-04-21 12:40:48 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-04-21 12:44:02 +0300 |
commit | 843f52ea6498363fdf99c36af6834ab394317103 (patch) | |
tree | 0d458a99354541f7b78a34edd48bbd160bc2735f /lib | |
parent | 6b76909c8f46cc8373255cba2ee94dd770cac66f (diff) |
Merge branch 'fix/encoding-issue' into 'master'
Fix encoding issue exporting a project
Closes #31186
See merge request !10824
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/git/encoding_helper.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/gitlab/git/encoding_helper.rb b/lib/gitlab/git/encoding_helper.rb index e57d228e688..f918074cb14 100644 --- a/lib/gitlab/git/encoding_helper.rb +++ b/lib/gitlab/git/encoding_helper.rb @@ -40,7 +40,13 @@ module Gitlab def encode_utf8(message) detect = CharlockHolmes::EncodingDetector.detect(message) if detect - CharlockHolmes::Converter.convert(message, detect[:encoding], 'UTF-8') + begin + CharlockHolmes::Converter.convert(message, detect[:encoding], 'UTF-8') + rescue ArgumentError => e + Rails.logger.warn("Ignoring error converting #{detect[:encoding]} into UTF8: #{e.message}") + + '' + end else clean(message) end |