Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2017-04-20 17:10:33 +0300
committerJames Lopez <james@jameslopez.es>2017-04-20 17:10:33 +0300
commit71b6a4ba85150c88414f50ac4965cab71021202d (patch)
treee61ebdd29a240e21c95724fafe4c96f39ee3d241 /lib/gitlab/git
parentb99853f509cca1c6ae1892513658add575230692 (diff)
Return empty string on UTF8 conversion with U_STRING_NOT_TERMINATED_WARNING error
Diffstat (limited to 'lib/gitlab/git')
-rw-r--r--lib/gitlab/git/encoding_helper.rb8
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