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 <david@davidnind.com>

JD Amended patch: remove ref to bug number, we use git!

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 0cf434b7a2)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
This commit is contained in:
David Cook 2023-01-16 06:03:13 +00:00 committed by Matt Blenkinsop
parent a076542019
commit 9e4bf2945d
1 changed files with 9 additions and 0 deletions

View File

@ -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);
}