Commit 9fbdedf1 authored by Evan Goldenberg's avatar Evan Goldenberg
Browse files

use mime_content_type when the browser serves a file as


application/octet-stream (bug #520739)
Signed-off-by: default avatarEvan Goldenberg <evang@catalyst.net.nz>
parent 1aaeb54b
......@@ -857,8 +857,16 @@ class ArtefactTypeFile extends ArtefactTypeFileBase {
throw new QuotaExceededException(get_string('uploadexceedsquota', 'artefact.file'));
}
}
$data->size = $size;
$data->filetype = $um->file['type'];
$data->size = $size;
// the browser wasn't sure, so use mime_content_type to guess
if($um->file['type'] == 'application/octet-stream') {
$data->filetype = mime_content_type($um->file['tmp_name']);
}
else {
$data->filetype = $um->file['type'];
}
$data->oldextension = $um->original_filename_extension();
$f = self::new_file($um->file['tmp_name'], $data);
$f->commit();
......
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