Bug 11994: OpenSearch plugins needs to be delivered with Content-Type application...
authorKatrin Fischer <katrin.fischer.83@web.de>
Fri, 1 May 2020 17:20:43 +0000 (17:20 +0000)
committerVictor Grousset/tuxayo <victor@tuxayo.net>
Thu, 23 Jul 2020 23:39:52 +0000 (01:39 +0200)
https://developer.mozilla.org/en-US/docs/Web/OpenSearch
Your server should serve OpenSearch plugins using
Content-Type: application/opensearchdescription+xml.

To test:
- Verify the Content-Type the file is delivered with
  is correct, for example using wget
  http://127.0.0.1:8080/cgi-bin/koha/opac-search.pl?format=opensearchdescription

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit f090c1d2cb9253d77c5bac3b8fa03c775af2f0f6)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit e15992e4eb1e194a8ecc3bf8f04b5a74e6e5520a)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>

(cherry picked from commit c1ef8a49de0dab37cfb94de9c3e13410989a2de7)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

C4/Output.pm
opac/opac-search.pl

index f8f8e13..7813616 100644 (file)
@@ -236,7 +236,7 @@ $content_type.
 
 If applicable, $cookie can be undef, and it will not be sent.
 
-$content_type is one of the following: 'html', 'js', 'json', 'xml', 'rss', or 'atom'.
+$content_type is one of the following: 'html', 'js', 'json', 'opensearchdescription', 'xml', 'rss', or 'atom'.
 
 $status is an HTTP status message, like '403 Authentication Required'. It defaults to '200 OK'.
 
@@ -260,7 +260,8 @@ sub output_with_http_headers {
         # NOTE: not using application/atom+xml or application/rss+xml because of
         # Internet Explorer 6; see bug 2078.
         'rss'  => 'text/xml',
-        'atom' => 'text/xml'
+        'atom' => 'text/xml',
+        'opensearchdescription' => 'application/opensearchdescription+xml',
     );
 
     die "Unknown content type '$content_type'" if ( !defined( $content_type_map{$content_type} ) );
index ff6e112..83a844f 100755 (executable)
@@ -1012,7 +1012,7 @@ $template->param(
     add_to_some_public_shelves  => $some_public_shelves,
 );
 
-my $content_type = ($format eq 'rss' or $format eq 'atom') ? $format : 'html';
+my $content_type = ($format eq 'rss' or $format eq 'atom' or $format eq 'opensearchdescription') ? $format : 'html';
 
 # If GoogleIndicTransliteration system preference is On Set parameter to load Google's javascript in OPAC search screens
 if (C4::Context->preference('GoogleIndicTransliteration')) {