Fix MIME types for various SuperCat feeds
authorDan Scott <dscott@laurentian.ca>
Mon, 11 Jun 2018 18:27:57 +0000 (14:27 -0400)
committerDan Scott <dscott@laurentian.ca>
Tue, 12 Jun 2018 17:26:44 +0000 (13:26 -0400)
Zotero depends on valid MIME types as a way of identifying content retrieved
via unAPI. Passing 'application/xml' instead of 'application/marcxml' or
'application/xml+mods' doesn't enable Zotero (or other applications) to
properly distinguish the content.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm
Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat/Feed.pm

index a5fea7e..a23293b 100644 (file)
@@ -480,8 +480,8 @@ sub unapi2_formats {
         print <<FORMATS;
 <formats id='$id'>
 <format name="holdings_xml" type="application/xml"/>
-<format name="marcxml" type="application/xml" namespace_uri="http://www.loc.gov/MARC21/slim" docs="http://www.loc.gov/marcxml/" schema_location="http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd"/>
-<format name="mods32" type="application/xml" namespace_uri="http://www.loc.gov/mods/v3" docs="http://www.loc.gov/mods/" schema_location="http://www.loc.gov/standards/mods/v3/mods-3-2.xsd"/>
+<format name="marcxml" type="application/marcxml" namespace_uri="http://www.loc.gov/MARC21/slim" docs="http://www.loc.gov/marcxml/" schema_location="http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd"/>
+<format name="mods32" type="application/mods+xml" namespace_uri="http://www.loc.gov/mods/v3" docs="http://www.loc.gov/mods/" schema_location="http://www.loc.gov/standards/mods/v3/mods-3-2.xsd"/>
 </formats>
 FORMATS
     } else {
@@ -911,7 +911,7 @@ sub supercat {
                    </format>
                    <format>
                      <name>ris</name>
-                     <type>text/plain</type>
+                     <type>application/x-research-info-systems</type>
                    </format>";
             }
 
@@ -971,7 +971,7 @@ sub supercat {
                </format>
                <format>
                  <name>ris</name>
-                 <type>text/plain</type>
+                 <type>application/x-research-info-systems</type>
                </format>";
 
         for my $h (@$list) {
index 56146cb..9896c52 100644 (file)
@@ -431,7 +431,7 @@ use base 'OpenILS::WWW::SuperCat::Feed';
 sub new {
     my $class = shift;
     my $self = $class->SUPER::build('<modsCollection version="3.0" xmlns="http://www.loc.gov/mods/" xmlns:mods="http://www.loc.gov/mods/"/>');
-    $self->{type} = 'application/xml';
+    $self->{type} = 'application/xml+mods';
     $self->{item_xpath} = '/mods:modsCollection';
     return $self;
 }
@@ -445,7 +445,7 @@ sub new {
     my $self = $class->SUPER::build($xml);
     $self->{doc}->documentElement->setNamespace('http://www.loc.gov/mods/', 'mods');
     $self->{doc}->documentElement->setNamespace('http://www.loc.gov/mods/', undef, 1);
-    $self->{type} = 'application/xml';
+    $self->{type} = 'application/xml+mods';
     $self->{holdings_xpath} = '/mods:mods';
     return $self;
 }
@@ -483,7 +483,7 @@ use base 'OpenILS::WWW::SuperCat::Feed::mods';
 sub new {
     my $class = shift;
     my $self = $class->SUPER::build('<modsCollection version="3.0" xmlns="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3"/>');
-    $self->{type} = 'application/xml';
+    $self->{type} = 'application/xml+mods';
     $self->{item_xpath} = '/mods:modsCollection';
     return $self;
 }
@@ -497,7 +497,7 @@ sub new {
     my $self = $class->SUPER::build($xml);
     $self->{doc}->documentElement->setNamespace('http://www.loc.gov/mods/v3', 'mods');
     $self->{doc}->documentElement->setNamespace('http://www.loc.gov/mods/v3', undef, 1);
-    $self->{type} = 'application/xml';
+    $self->{type} = 'application/xml+mods';
     $self->{holdings_xpath} = '/mods:mods';
     return $self;
 }
@@ -534,7 +534,7 @@ use base 'OpenILS::WWW::SuperCat::Feed::mods3';
 sub new {
     my $class = shift;
     my $self = $class->SUPER::build('<modsCollection version="3.2" xmlns="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3"/>');
-    $self->{type} = 'application/xml';
+    $self->{type} = 'application/xml+mods';
     $self->{item_xpath} = '/mods:modsCollection';
     return $self;
 }
@@ -550,7 +550,7 @@ use base 'OpenILS::WWW::SuperCat::Feed::mods3';
 sub new {
     my $class = shift;
     my $self = $class->SUPER::build('<modsCollection version="3.3" xmlns="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3"/>');
-    $self->{type} = 'application/xml';
+    $self->{type} = 'application/xml+mods';
     $self->{item_xpath} = '/mods:modsCollection';
     return $self;
 }
@@ -567,7 +567,7 @@ use base 'OpenILS::WWW::SuperCat::Feed';
 sub new {
     my $class = shift;
     my $self = $class->SUPER::build('<collection xmlns="http://www.loc.gov/MARC21/slim" xmlns:marc="http://www.loc.gov/MARC21/slim"/>');
-    $self->{type} = 'application/xml';
+    $self->{type} = 'application/marcxml';
     $self->{item_xpath} = '/marc:collection';
     return $self;
 }
@@ -598,7 +598,7 @@ sub new {
     my $self = $class->SUPER::build($xml);
     return undef unless $self;
     $self->{doc}->documentElement->setNamespace('http://www.loc.gov/MARC21/slim', undef);
-    $self->{type} = 'application/xml';
+    $self->{type} = 'application/marcxml';
     $self->{holdings_xpath} = '/*[local-name()="record"]';
     return $self;
 }
@@ -807,7 +807,7 @@ use base 'OpenILS::WWW::SuperCat::Feed::marcxml';
 sub new {
     my $class = shift;
     my $self = $class->SUPER::new;
-    $self->{type} = 'text/plain';
+    $self->{type} = 'application/x-research-info-systems';
     $self->{xsl} = "/MARC21slim2RIS.xsl";
     return $self;
 }
@@ -859,7 +859,7 @@ use MARC::File::XML ( BinaryEncoding => 'utf8', RecordFormat => 'USMARC' );
 sub new {
     my $class = shift;
     my $self = $class->SUPER::new;
-    $self->{type} = 'application/octet-stream';
+    $self->{type} = 'application/marc';
     return $self;
 }