summaryrefslogtreecommitdiff
path: root/lib/gitlab/encoding_helper.rb
diff options
context:
space:
mode:
authorAhmad Sherif <me@ahmadsherif.com>2018-03-22 21:22:20 +0100
committerAhmad Sherif <me@ahmadsherif.com>2018-03-22 21:22:20 +0100
commit1f2cc29c8f703cedc03645bc365fda068f33a86b (patch)
tree2d37cf540932f9c675928f5d6ffe12e003f10445 /lib/gitlab/encoding_helper.rb
parent5c36e1b96a7c159a3f8a71528b14cc1c726a8bb9 (diff)
downloadgitlab-ce-1f2cc29c8f703cedc03645bc365fda068f33a86b.tar.gz
Fix EncodingHelper#clean blowing up on UTF-16BE stringsfix/encoding-helper-clean-blowing-up-on-utf-16be
Closes gitaly#1101
Diffstat (limited to 'lib/gitlab/encoding_helper.rb')
-rw-r--r--lib/gitlab/encoding_helper.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/gitlab/encoding_helper.rb b/lib/gitlab/encoding_helper.rb
index 6659efa0961..0b8f6cfe3cb 100644
--- a/lib/gitlab/encoding_helper.rb
+++ b/lib/gitlab/encoding_helper.rb
@@ -90,7 +90,7 @@ module Gitlab
end
def clean(message)
- message.encode("UTF-16BE", undef: :replace, invalid: :replace, replace: "")
+ message.encode("UTF-16BE", undef: :replace, invalid: :replace, replace: "".encode("UTF-16BE"))
.encode("UTF-8")
.gsub("\0".encode("UTF-8"), "")
end