summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAhmad Sherif <me@ahmadsherif.com>2018-02-09 18:58:29 +0100
committerAhmad Sherif <me@ahmadsherif.com>2018-02-09 22:19:43 +0100
commit0d9107374a2caddea61351d2fd5ba619cb69df81 (patch)
treee009d879bd291ab7a4d9a1c441d6dfed21b58918 /lib
parent721fab661de4a01c2d73e88bdd000dfe2e094ced (diff)
downloadgitlab-ce-0d9107374a2caddea61351d2fd5ba619cb69df81.tar.gz
Return a warning string if we try to encode to unsupported encoding
Fixes gitlab-development-kit#321
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/encoding_helper.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/gitlab/encoding_helper.rb b/lib/gitlab/encoding_helper.rb
index c0edcabc6fd..6659efa0961 100644
--- a/lib/gitlab/encoding_helper.rb
+++ b/lib/gitlab/encoding_helper.rb
@@ -28,9 +28,9 @@ module Gitlab
# encode and clean the bad chars
message.replace clean(message)
- rescue ArgumentError
- return nil
- rescue
+ rescue ArgumentError => e
+ return unless e.message.include?('unknown encoding name')
+
encoding = detect ? detect[:encoding] : "unknown"
"--broken encoding: #{encoding}"
end