escape wildcard query

This commit is contained in:
Pete Matsyburka committed 2026-02-14 12:02:25 +02:00
1 parent 680ab9dbed
commit 34ea639c25
3 files changed
+9 -4

No files matched your search

+3 -1
View File
@@ -52,7 +52,9 @@ module Templates
def plain_search(templates, keyword)
return templates if keyword.blank?
templates.where(Template.arel_table[:name].lower.matches("%#{keyword.downcase}%"))
sanitized = ActiveRecord::Base.sanitize_sql_like(keyword.downcase)
templates.where(Template.arel_table[:name].lower.matches("%#{sanitized}%"))
end
def fulltext_search(current_user, templates, keyword)