about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-11-13 11:27:13 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-11-13 11:27:13 +0100
commit8152584cf57c2b5a797d73f5afac0bba3c904f6d (patch)
tree6fa7e61a88f5fe759a745e3a58dc855dfbdb1e2d /app/models
parent20aa777c58595cfe82ef0ab7b8853ce735901919 (diff)
Fix #142 - Escape ILIKE special characters from Account.find_remote
Diffstat (limited to 'app/models')
-rw-r--r--app/models/account.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index 47de161d8..81b724935 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -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)