summaryrefslogtreecommitdiff
path: root/lib/gitlab/auth/o_auth
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2019-07-25 21:33:32 +1200
committerThong Kuah <tkuah@gitlab.com>2019-07-26 00:13:25 +1200
commitd4ef3be35b63f3ef022e21d6ba56ffe41b8f192c (patch)
treef091fea00139368a7401238930d9bc809616b6f3 /lib/gitlab/auth/o_auth
parent595a092a083a9a16cad12dc663cad1a674551a51 (diff)
downloadgitlab-ce-d4ef3be35b63f3ef022e21d6ba56ffe41b8f192c.tar.gz
Frozen string cannot change encodingfrozen_string_spec_support
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/auth/o_auth')
-rw-r--r--lib/gitlab/auth/o_auth/auth_hash.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/gitlab/auth/o_auth/auth_hash.rb b/lib/gitlab/auth/o_auth/auth_hash.rb
index 72a187377d0..91b9ddc0d00 100644
--- a/lib/gitlab/auth/o_auth/auth_hash.rb
+++ b/lib/gitlab/auth/o_auth/auth_hash.rb
@@ -60,8 +60,7 @@ module Gitlab
def get_info(key)
value = info[key]
- Gitlab::Utils.force_utf8(value) if value
- value
+ value.is_a?(String) ? Gitlab::Utils.force_utf8(value) : value
end
def username_and_email