From 8152584cf57c2b5a797d73f5afac0bba3c904f6d Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sun, 13 Nov 2016 11:27:13 +0100 Subject: Fix #142 - Escape ILIKE special characters from Account.find_remote --- app/models/account.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') 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) -- cgit