Use Arel `matches` method in CustomEmoji search (#28615)

This commit is contained in:
Matt Jankowski 2024-01-08 08:26:12 -05:00 committed by GitHub
parent cc67943df2
commit e827c4692c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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