mirror of
https://github.com/moodle/moodle.git
synced 2025-05-02 14:28:30 +02:00
MDL-13766, fixed mimetype validation.
This commit is contained in:
parent
16f61c701e
commit
2385e6de5b
@ -164,14 +164,14 @@ switch ($action) {
|
||||
case 'download':
|
||||
// validate mimetype
|
||||
$mimetypes = array();
|
||||
if (in_array('*', $accepted_types) or $accepted_types == '*') {
|
||||
if ((is_array($accepted_types) and in_array('*', $accepted_types)) or $accepted_types == '*') {
|
||||
$mimetypes = '*';
|
||||
} else {
|
||||
foreach ($accepted_types as $type) {
|
||||
$mimetypes[] = mimeinfo('type', $type);
|
||||
}
|
||||
if (!in_array(mimeinfo('type', $saveas_filename), $mimetypes)) {
|
||||
throw new moodle_exception('invalidfiletype', 'repository', '', mimeinfo('type', $_FILES[$elname]['name']));
|
||||
throw new moodle_exception('invalidfiletype', 'repository', '', mimeinfo('type', $saveas_filename));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user