users: fix find_by_name for names with special characters.
`User.find_by_name` used `where_ilike` to do a case-insensitve name search, but it didn't escape `*` or `\` characters first, so it didn't handle names containing these characters properly.
This commit is contained in:
@@ -142,7 +142,7 @@ class User < ApplicationRecord
|
||||
|
||||
# XXX downcasing is the wrong way to do case-insensitive comparison for unicode (should use casefolding).
|
||||
def find_by_name(name)
|
||||
where_ilike(:name, normalize_name(name)).first
|
||||
where_iequals(:name, normalize_name(name)).first
|
||||
end
|
||||
|
||||
def normalize_name(name)
|
||||
|
||||
Reference in New Issue
Block a user