Add 'results' route redirect

This commit is contained in:
Omar Roth 2018-07-29 21:05:40 -05:00
parent a09b12a774
commit 714fd3dae3

View File

@ -1329,6 +1329,15 @@ get "/embed/:id" do |env|
rendered "embed" rendered "embed"
end end
get "/results" do |env|
search_query = env.params.query["search_query"]?
if search_query
env.redirect "/search?q=#{URI.escape(search_query)}"
else
env.redirect "/"
end
end
get "/search" do |env| get "/search" do |env|
if env.params.query["q"]? if env.params.query["q"]?
query = env.params.query["q"] query = env.params.query["q"]