From 398402316c4669df7a82ac1bf99c7fd890e153b6 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 Signed-off-by: Owen Leonard --- 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 ce2cefc..a772cf4 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -116,6 +116,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, @@ -139,7 +142,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 @@ -745,7 +748,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.1.4