Skip to content

Commit

Permalink
Fix search API not resolving URL when type is given (mastodon#11822)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gargron authored and hiyuki2578 committed Oct 2, 2019
1 parent e527d26 commit 0cee396
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/services/search_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def call(query, account, limit, options = {})

default_results.tap do |results|
if url_query?
results.merge!(url_resource_results) unless url_resource.nil?
results.merge!(url_resource_results) unless url_resource.nil? || (@options[:type].present? && url_resource_symbol != @options[:type].to_sym)
elsif @query.present?
results[:accounts] = perform_accounts_search! if account_searchable?
results[:statuses] = perform_statuses_search! if full_text_searchable?
Expand Down Expand Up @@ -69,7 +69,7 @@ def default_results
end

def url_query?
@options[:type].blank? && @query =~ /\Ahttps?:\/\//
@resolve && @query =~ /\Ahttps?:\/\//
end

def url_resource_results
Expand Down

0 comments on commit 0cee396

Please sign in to comment.