Skip to content

Commit

Permalink
Force utf8 encoding when updating realname
Browse files Browse the repository at this point in the history
In proxy mode make sure that the user realname is a proper utf8 string.

Fixes #5872.

Co-authored-by: Henne Vogelsang <hvogel@opensuse.org>
  • Loading branch information
eduardoj and hennevogel committed Sep 25, 2018
1 parent 45022ff commit 9191af7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/api/app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def update_user_info_from_proxy_env(env)
save
end
return unless env['HTTP_X_FIRSTNAME'].present? && env['HTTP_X_LASTNAME'].present?
realname = env['HTTP_X_FIRSTNAME'] + ' ' + env['HTTP_X_LASTNAME']
realname = env['HTTP_X_FIRSTNAME'].force_encoding('UTF-8') + ' ' + env['HTTP_X_LASTNAME'].force_encoding('UTF-8')
return unless self.realname != realname

self.realname = realname
Expand Down

0 comments on commit 9191af7

Please sign in to comment.