From 4c5d38d5b595fe9f2dc33b046a35164d5757ea55 Mon Sep 17 00:00:00 2001 From: Piet Schijven Date: Wed, 19 Jun 2024 15:11:52 +0200 Subject: [PATCH] OpenCode Issue 13: Correct handling of search requests without search query parameter. --- app/controllers/search_results_controller.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/controllers/search_results_controller.rb b/app/controllers/search_results_controller.rb index 1d3a098de..0f54d574b 100644 --- a/app/controllers/search_results_controller.rb +++ b/app/controllers/search_results_controller.rb @@ -91,7 +91,7 @@ def index @remote_result_collections = [] - if params[:query] + if params[:query].present? # Deal with language parameter patterns languages = [] # Either "l[]=de&l[]=en" as well as "l=de,en" should be possible @@ -142,6 +142,15 @@ def index } format.any(:ttl, :rdf, :nt) end + else + respond_to do |format| + format.html do + render :index + end + format.any(:ttl) do + head :bad_request + end + end end end