0
0
Fork 0

Fix #142 - Escape ILIKE special characters from Account.find_remote

This commit is contained in:
Eugen Rochko 2016-11-13 11:27:13 +01:00
parent 20aa777c58
commit 8152584cf5
2 changed files with 43 additions and 3 deletions

View file

@ -142,7 +142,7 @@ class Account < ApplicationRecord
end
def find_remote!(username, domain)
where(arel_table[:username].matches(username)).where(domain.nil? ? { domain: nil } : arel_table[:domain].matches(domain)).take!
where(arel_table[:username].matches(username.gsub(/[%_]/, '\\\\\0'))).where(domain.nil? ? { domain: nil } : arel_table[:domain].matches(domain.gsub(/[%_]/, '\\\\\0'))).take!
end
def find_local(username)