Browse Source

Merge pull request #608 from jordandukart/7.x-ISLANDORA-1258

Handle the XML case of MIME types.
pull/609/head
William Panting 10 years ago
parent
commit
3de5b8608f
  1. 2
      includes/mimetype.utils.inc
  2. 6
      islandora.module

2
includes/mimetype.utils.inc

@ -22,6 +22,8 @@ function islandora_get_extension_for_mimetype($mimetype) {
$mimetype_mapping = file_mimetype_mapping(); $mimetype_mapping = file_mimetype_mapping();
$extension_index = array_search($mimetype, $mimetype_mapping['mimetypes']); $extension_index = array_search($mimetype, $mimetype_mapping['mimetypes']);
if ($extension_index !== FALSE) { if ($extension_index !== FALSE) {
// Reversing such that any altered values take precedence over the default
// mappings.
$mime_array_flipped = array_reverse($mimetype_mapping['extensions']); $mime_array_flipped = array_reverse($mimetype_mapping['extensions']);
$extension = array_search($extension_index, $mime_array_flipped); $extension = array_search($extension_index, $mime_array_flipped);
} }

6
islandora.module

@ -1662,6 +1662,12 @@ function islandora_file_mimetype_mapping_alter(&$mapping) {
end($mapping['mimetypes']); end($mapping['mimetypes']);
$mapping['extensions'][$ext] = key($mapping['mimetypes']); $mapping['extensions'][$ext] = key($mapping['mimetypes']);
} }
// Get the current XML mapping and unset it so it comes last when we do our
// reverse when getting mimetypes from extensions for use in downloads.
// @see islandora_get_extension_for_mimetype.
$xml_int = $mapping['extensions']['xml'];
unset($mapping['extensions']['xml']);
$mapping['extensions']['xml'] = $xml_int;
} }
/** /**

Loading…
Cancel
Save