From 08b46701d8e89d74f1c6af665ae26a83d646ee85 Mon Sep 17 00:00:00 2001 From: David Cook Date: Mon, 16 Jan 2023 06:03:13 +0000 Subject: [PATCH] Bug 32639: Send opac-search.osdx without doing an empty search This patch sends out opac-search.osdx without running the entirety of opac-search.pl without any search query. This prevents unnecessary computations and warnings from appearing in the logs. Test plan: 1. Apply patch 2. Go to http://kohadev.myDNSname.org:8080/cgi-bin/koha/opac-search.pl?format=opensearchdescription 3. Note that no errors appear in /var/log/koha/kohadev/plack-opac-error.log 4. Verify that opac-search.pl still works as expected when doing a search via the web UI Signed-off-by: David Nind JD Amended patch: remove ref to bug number, we use git! Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 0cf434b7a2654c17e60af1969faf99ca77ef42dc) Signed-off-by: Matt Blenkinsop (cherry picked from commit 9e4bf2945d4547efd9d99229f36633a13514bdda) Signed-off-by: Lucas Gass (cherry picked from commit 19972170f1330e19d03f1f5ed12a236375bda6a0) Signed-off-by: Arthur Suzuki --- opac/opac-search.pl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/opac/opac-search.pl b/opac/opac-search.pl index adcdf7a9db..cec7a9989c 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -142,10 +142,19 @@ if($cgi->cookie("bib_list")){ if ($format eq 'rss' or $format eq 'opensearchdescription' or $format eq 'atom') { $template->param($format => 1); + #NOTE: opensearchdescription doesn't actually use timestamp... $template->param(timestamp => strftime("%Y-%m-%dT%H:%M:%S-00:00", gmtime)) if ($format eq 'atom'); # FIXME - the timestamp is a hack - the biblio update timestamp should be used for each # entry, but not sure if that's worth an extra database query for each bib } + +#NOTE: Return now for 'opensearchdescription' BZ 32639 +if ( $format && $format eq 'opensearchdescription' ){ + my $content_type = $format; + output_with_http_headers $cgi, $cookie, $template->output, $content_type; + exit; +} + if (C4::Context->preference("marcflavour") eq "UNIMARC" ) { $template->param('UNIMARC' => 1); } -- 2.39.5