summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2018-02-09 22:01:16 +0000
committerRobert Speicher <robert@gitlab.com>2018-02-09 22:01:16 +0000
commit498ade4801a822f8704390b10d178af9fe7987cb (patch)
treeaa27ec6d4b301e98e5957c1e036318f0f05a799f /lib
parent97a59cb7ce2b0049093e0059ac29965f5c745dab (diff)
parent0d9107374a2caddea61351d2fd5ba619cb69df81 (diff)
downloadgitlab-ce-498ade4801a822f8704390b10d178af9fe7987cb.tar.gz
Merge branch 'fix/encoding-to-unsupported-encodings' into 'master'
Return a warning string if we try to encode to unsupported encoding Closes gitlab-development-kit#321 See merge request gitlab-org/gitlab-ce!17038
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