Skip to content
Snippets Groups Projects
Commit 6a82939a authored by Andrea Scarpino's avatar Andrea Scarpino Committed by Eugen Rochko
Browse files

Fix account and tag searches with leading/trailing spaces (#5965)

* Strip leading & trailing spaces from account query

* Strip leading & trailing spaces from tag search
parent 98aa96b8
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@ class Tag < ApplicationRecord
class << self
def search_for(term, limit = 5)
pattern = sanitize_sql_like(term) + '%'
pattern = sanitize_sql_like(term.strip) + '%'
Tag.where('lower(name) like lower(?)', pattern).order(:name).limit(limit)
end
end
......
......@@ -4,7 +4,7 @@ class AccountSearchService < BaseService
attr_reader :query, :limit, :options, :account
def call(query, limit, account = nil, options = {})
@query = query
@query = query.strip
@limit = limit
@options = options
@account = account
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment