Skip to content

Commit

Permalink
Merge pull request #755 from turnitin/allowed-file-types
Browse files Browse the repository at this point in the history
Respect allowed file types option
  • Loading branch information
jack-tii authored Jul 30, 2024
2 parents 5ebc738 + 32925e6 commit a73553a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions view.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,17 @@
$maxbytescourse,
$turnitintooltwoassignment->turnitintooltwo->maxfilesize);
$maxfilesize = ($maxfilesize <= 0) ? TURNITINTOOLTWO_MAX_FILE_UPLOAD_SIZE : $maxfilesize;
$turnitintooltwofileuploadoptions = array('maxbytes' => $maxfilesize,
'subdirs' => false, 'maxfiles' => 1, 'accepted_types' => '*');

if ($turnitintooltwoassignment->turnitintooltwo->allownonor) {
$acceptedtypes = ['*'];
}
else {
$acceptedtypes = ['.doc', '.docx', '.ppt', '.pptx', '.pps', '.ppsx',
'.pdf', '.txt', '.htm', '.html', '.hwp', '.hwpx',
'.odt', '.wpd', '.ps', '.rtf', '.xls', '.xlsx'];
}
$turnitintooltwofileuploadoptions = ['maxbytes' => $maxfilesize,
'subdirs' => false, 'maxfiles' => 1, 'accepted_types' => $acceptedtypes];

if (!$parts = $turnitintooltwoassignment->get_parts()) {
turnitintooltwo_print_error('partgeterror', 'turnitintooltwo', null, null, __FILE__, __LINE__);
Expand Down

0 comments on commit a73553a

Please sign in to comment.