Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2019-07-25 12:33:32 +0300
committerThong Kuah <tkuah@gitlab.com>2019-07-25 15:13:25 +0300
commitd4ef3be35b63f3ef022e21d6ba56ffe41b8f192c (patch)
treef091fea00139368a7401238930d9bc809616b6f3 /lib/gitlab/auth
parent595a092a083a9a16cad12dc663cad1a674551a51 (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/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