mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: 500 error when creating a user with an integer username (#16370)
Via the API it is possible to create a user with an integer username. So 123 instead of "123". This causes the following 500 error: ``` NoMethodError (undefined method `unicode_normalize' for 1:Integer) app/models/user.rb:276:in `normalize_username' ``` See: https://meta.discourse.org/t/222281
This commit is contained in:
@@ -273,7 +273,7 @@ class User < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def self.normalize_username(username)
|
||||
username.unicode_normalize.downcase if username.present?
|
||||
username.to_s.unicode_normalize.downcase if username.present?
|
||||
end
|
||||
|
||||
def self.username_available?(username, email = nil, allow_reserved_username: false)
|
||||
|
||||
Reference in New Issue
Block a user