diff --git a/includes/datastream.inc b/includes/datastream.inc index edc8ceb1..592870b7 100644 --- a/includes/datastream.inc +++ b/includes/datastream.inc @@ -30,6 +30,7 @@ function islandora_download_datastream(AbstractDatastream $datastream) { * The version of the datastream to display */ function islandora_view_datastream(AbstractDatastream $datastream, $download = FALSE, $version = NULL) { + module_load_include('inc', 'islandora', 'includes/mimetype.utils'); // XXX: Certain features of the Devel module rely on the use of "shutdown // handlers", such as query logging... The problem is that they might blindly // add additional output which will break things if what is actually being @@ -45,7 +46,6 @@ function islandora_view_datastream(AbstractDatastream $datastream, $download = F return drupal_not_found(); } } - header('Content-type: ' . $datastream->mimetype); if ($datastream->controlGroup == 'M' || $datastream->controlGroup == 'X') { header('Content-length: ' . $datastream->size); @@ -53,7 +53,7 @@ function islandora_view_datastream(AbstractDatastream $datastream, $download = F if ($download) { // Browsers will not append all extensions. $mime_detect = new MimeDetect(); - $extension = '.' . $mime_detect->getExtension($datastream->mimetype); + $extension = '.' . islandora_get_extension_for_mimetype($datastream->mimetype); // Prevent adding on a duplicate extension. $label = $datastream->label; $extension_length = strlen($extension); diff --git a/includes/mime_detect.inc b/includes/mime_detect.inc index 29fcf1e5..da2c69f3 100644 --- a/includes/mime_detect.inc +++ b/includes/mime_detect.inc @@ -134,7 +134,6 @@ class MimeDetect { 'xhtml' => 'application/xhtml+xml', 'xsl' => 'text/xsl', 'xslt' => 'text/xsl', - 'xml' => 'application/xml', 'csv' => 'text/csv', 'tsv' => 'text/tab-separated-values', 'txt' => 'text/plain', diff --git a/includes/mimetype.utils.inc b/includes/mimetype.utils.inc new file mode 100644 index 00000000..989c55cd --- /dev/null +++ b/includes/mimetype.utils.inc @@ -0,0 +1,31 @@ +getMimeTypes(); + $diff = array_diff_key($types, $mapping['extensions']); foreach ($diff as $ext => $mime) { $mapping['mimetypes'][] = $mime;