Fix #3590: Superfluous space added on certain autocompletions.

Bug: searching for /wiki_pages?search[title]=touhou%20 didn't find the
'touhou' wiki. The space wasn't stripped when the title was normalized.
This commit is contained in:
evazion
2018-03-30 22:24:34 -05:00
parent 80219a0ccf
commit 75cc1421a3

View File

@@ -67,7 +67,7 @@ class WikiPage < ApplicationRecord
q = super
if params[:title].present?
q = q.where("title LIKE ? ESCAPE E'\\\\'", params[:title].mb_chars.downcase.tr(" ", "_").to_escaped_for_sql_like)
q = q.where("title LIKE ? ESCAPE E'\\\\'", params[:title].mb_chars.downcase.strip.tr(" ", "_").to_escaped_for_sql_like)
end
if params[:creator_id].present?