From e827c4692c251e60509d30350660244b403b5760 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 8 Jan 2024 08:26:12 -0500 Subject: [PATCH] Use Arel `matches` method in CustomEmoji search (#28615) --- app/models/custom_emoji.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/custom_emoji.rb b/app/models/custom_emoji.rb index 550f005d59..1c9b443959 100644 --- a/app/models/custom_emoji.rb +++ b/app/models/custom_emoji.rb @@ -86,7 +86,7 @@ class CustomEmoji < ApplicationRecord end def search(shortcode) - where('"custom_emojis"."shortcode" ILIKE ?', "%#{shortcode}%") + where(arel_table[:shortcode].matches("%#{sanitize_sql_like(shortcode)}%")) end end