Commit 52e65ecf authored by Nigel McNie's avatar Nigel McNie
Browse files

Allow text files through no matter what subtype they are. They might not all...

Allow text files through no matter what subtype they are. They might not all get descriptions, but they are harmless.
parent ca2dadfb
......@@ -91,12 +91,14 @@ class upload_manager {
require_once('file.php');
$type = get_mime_type($file['tmp_name']);
if ($type) {
$validtypes = get_column_sql('SELECT mimetype
FROM {artefact_file_mime_types} m
LEFT JOIN {artefact_file_file_types} f ON (m.description = f.description)
WHERE f.enabled = 1');
if (!in_array($type, $validtypes)) {
return get_string('filetypenotallowed');
if (substr($type, 0, 5) != 'text/') {
$validtypes = get_column_sql('SELECT mimetype
FROM {artefact_file_mime_types} m
LEFT JOIN {artefact_file_file_types} f ON (m.description = f.description)
WHERE f.enabled = 1');
if (!in_array($type, $validtypes)) {
return get_string('filetypenotallowed');
}
}
}
......
Supports Markdown
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