Use if/else instead of return in search route

pull/2155/head
Samantaz Fox 4 years ago
parent a2f5342a83
commit 3de92b337d

@ -45,27 +45,26 @@ class Invidious::Routes::Search < Invidious::Routes::BaseRoute
# Display the full page search box implemented in #1977 # Display the full page search box implemented in #1977
env.set "search", "" env.set "search", ""
templated "search_homepage", navbar_search: false templated "search_homepage", navbar_search: false
return else
end page = env.params.query["page"]?.try &.to_i?
page ||= 1
page = env.params.query["page"]?.try &.to_i? user = env.get? "user"
page ||= 1
user = env.get? "user" begin
search_query, count, videos, operators = process_search_query(query, page, user, region: region)
rescue ex
return error_template(500, ex)
end
begin operator_hash = {} of String => String
search_query, count, videos, operators = process_search_query(query, page, user, region: region) operators.each do |operator|
rescue ex key, value = operator.downcase.split(":")
return error_template(500, ex) operator_hash[key] = value
end end
operator_hash = {} of String => String env.set "search", query
operators.each do |operator| templated "search"
key, value = operator.downcase.split(":")
operator_hash[key] = value
end end
env.set "search", query
templated "search"
end end
end end

Loading…
Cancel
Save