diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2019-12-04 04:34:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-04 04:34:08 +0100 |
commit | bbf926b1c01ac1882d05cb3e59e84044ead5dd9f (patch) | |
tree | 73eaa3d933ced7efbfccf4f71dc0cd85c73ee19d | |
parent | 4354936a3983626d94a3594a36813e770e0dc87d (diff) |
Fix error when using search API with no query (#12541)
Fix #12462
-rw-r--r-- | app/services/search_service.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/services/search_service.rb b/app/services/search_service.rb index 3a498dcf4..090fd409b 100644 --- a/app/services/search_service.rb +++ b/app/services/search_service.rb @@ -2,7 +2,7 @@ class SearchService < BaseService def call(query, account, limit, options = {}) - @query = query.strip + @query = query&.strip @account = account @options = options @limit = limit.to_i @@ -10,6 +10,8 @@ class SearchService < BaseService @resolve = options[:resolve] || false default_results.tap do |results| + next if @query.blank? + if url_query? results.merge!(url_resource_results) unless url_resource.nil? || (@options[:type].present? && url_resource_symbol != @options[:type].to_sym) elsif @query.present? |