diff --git a/includes/mime_detect.inc b/includes/mime_detect.inc index 3c3741dd..13b66cc8 100644 --- a/includes/mime_detect.inc +++ b/includes/mime_detect.inc @@ -376,7 +376,7 @@ class MimeDetect { * Gets MIME type array. * * @return array - * returns associative array with exts and mimetypes + * Returns associative array with exts and mimetypes. */ public function getMimeTypes() { return $this->protectedMimeTypes; diff --git a/islandora.module b/islandora.module index 3899ddb9..d6c89e99 100644 --- a/islandora.module +++ b/islandora.module @@ -1113,22 +1113,16 @@ function islandora_download_clip(AbstractObject $object) { /** * Implements hook_file_mimetype_mapping_alter(). * - * Grab custom islandora mime type list and add any missing ext/mimes to the drupal mapping - * - * @param array $mapping - * The Drupal mimetype mapping. + * Grab custom islandora mime type list + * and add any missing ext/mimes to the drupal mapping */ function islandora_file_mimetype_mapping_alter(&$mapping) { $mime_detect = new MimeDetect(); $types = $mime_detect->getMimeTypes(); $diff = array_diff_key($types, $mapping['extensions']); foreach ($diff as $ext => $mime) { - if (!isset($mapping['extensions'][$ext])) { - $mapping['mimetypes'][] = $mime; - $last = end($mapping['mimetypes']); - reset($mapping['mimetypes']); - $key = array_search($mime, $mapping['mimetypes']); - $mapping['extensions'][$ext] = $key; - } + $mapping['mimetypes'][] = $mime; + end($mapping['mimetypes']); + $mapping['extensions'][$ext] = key($mapping['mimetypes']); } }