MDL-42222 Assignment: Added type check before checking mimetype
Online submission type pass string in files, so added check to see if file is of type stored_file then check mimetype
This commit is contained in:
@@ -117,7 +117,7 @@ class document_services {
|
||||
if ($plugin->is_enabled() && $plugin->is_visible()) {
|
||||
$pluginfiles = $plugin->get_files($submission, $user);
|
||||
foreach ($pluginfiles as $filename => $file) {
|
||||
if ($file->get_mimetype() === 'application/pdf') {
|
||||
if (($file instanceof \stored_file) && ($file->get_mimetype() === 'application/pdf')) {
|
||||
$files[$filename] = $file;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,8 @@ class assignfeedback_editpdf_testcase extends mod_assign_base_testcase {
|
||||
|
||||
protected function create_assign_and_submit_pdf() {
|
||||
global $CFG;
|
||||
$assign = $this->create_instance(array('assignsubmission_file_enabled' => 1,
|
||||
$assign = $this->create_instance(array('assignsubmission_onlinetext_enabled' => 1,
|
||||
'assignsubmission_file_enabled' => 1,
|
||||
'assignsubmission_file_maxfiles' => 1,
|
||||
'assignfeedback_editpdf_enabled' => 1,
|
||||
'assignsubmission_file_maxsizebytes' => 1000000));
|
||||
|
||||
Reference in New Issue
Block a user