diff options
author | Thong Kuah <tkuah@gitlab.com> | 2019-07-25 12:33:32 +0300 |
---|---|---|
committer | Thong Kuah <tkuah@gitlab.com> | 2019-07-25 15:13:25 +0300 |
commit | d4ef3be35b63f3ef022e21d6ba56ffe41b8f192c (patch) | |
tree | f091fea00139368a7401238930d9bc809616b6f3 /lib/gitlab/utils.rb | |
parent | 595a092a083a9a16cad12dc663cad1a674551a51 (diff) |
Frozen string cannot change encoding
This was shown in specs but surely this will be happening in application
code as well if this method is passes a frozen string.
We were also trying to force_encode a OmniAuth::AuthHash which had the
very confusing behaviour of returning nil when it was sent a method that
it did not define. Fix that by only force_encoding a String.
Diffstat (limited to 'lib/gitlab/utils.rb')
-rw-r--r-- | lib/gitlab/utils.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/gitlab/utils.rb b/lib/gitlab/utils.rb index 31c9e18c996..c66ce0434a4 100644 --- a/lib/gitlab/utils.rb +++ b/lib/gitlab/utils.rb @@ -22,7 +22,7 @@ module Gitlab end def force_utf8(str) - str.force_encoding(Encoding::UTF_8) + str.dup.force_encoding(Encoding::UTF_8) end def ensure_utf8_size(str, bytes:) |