Commit 110ea960 authored by abu-zakham's avatar abu-zakham Committed by joseph.olstad

Issue #2610058 by mkhamash, abu-zakham: Media internet fails to validate file...

Issue #2610058 by mkhamash, abu-zakham: Media internet fails to validate file type when multiple files type have the same mime
parent 5401a8f9
...@@ -1137,7 +1137,9 @@ function media_get_thumbnail_preview($file, $link = FALSE, $view_mode = 'preview ...@@ -1137,7 +1137,9 @@ function media_get_thumbnail_preview($file, $link = FALSE, $view_mode = 'preview
*/ */
function media_file_validate_types($file, $types) { function media_file_validate_types($file, $types) {
$errors = array(); $errors = array();
if (!in_array(file_get_type($file), $types)) {
$file_candidates = array_keys(file_entity_get_filetype_candidates($file));
if (!array_intersect($file_candidates, $types)) {
$errors[] = t('Only the following types of files are allowed to be uploaded: %types-allowed', array('%types-allowed' => implode(', ', $types))); $errors[] = t('Only the following types of files are allowed to be uploaded: %types-allowed', array('%types-allowed' => implode(', ', $types)));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment