From a8375871f667e75fcdaa38813902facb1a1eee41 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 18 Jun 2018 17:31:27 -0300 Subject: [PATCH] Bug 16111: Fix content type for RSS feed Test plan: GET http://catalogue/cgi-bin/koha/opac-search.pl?idx=kw&q=perl&count=50&sort_by=acqdate_dsc&format=rss2 => Without this patch it returns content type text/html => With this patch it returns text/xml GET http://catalogue/cgi-bin/koha/opac-search.pl?idx=kw&q=perl&count=50&sort_by=acqdate_dsc&format=rss => Without this patch it does not work => With this patch it returns text/xml --- opac/opac-search.pl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 1d7615bc5c..b6dc9fe785 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -115,6 +115,9 @@ else { $template_name = 'opac-advsearch.tt'; $template_type = 'advsearch'; } + +$format = 'rss' if $format =~ /rss/; + # load the template ($template, $borrowernumber, $cookie) = get_template_and_user({ template_name => $template_name, @@ -138,7 +141,7 @@ if($cgi->cookie("bib_list")){ @cart_list = split(/\//, $cart_list); } -if ($format eq 'rss2' or $format eq 'opensearchdescription' or $format eq 'atom') { +if ($format eq 'rss' or $format eq 'opensearchdescription' or $format eq 'atom') { $template->param($format => 1); $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 @@ -735,7 +738,7 @@ for (my $i=0;$i<@servers;$i++) { } ## If there's just one result, redirect to the detail page - if ($total == 1 && $format ne 'rss2' + if ($total == 1 && $format ne 'rss' && $format ne 'opensearchdescription' && $format ne 'atom') { my $biblionumber=$newresults[0]->{biblionumber}; if (C4::Context->preference('BiblioDefaultView') eq 'isbd') { -- 2.11.0