Skip to content

Commit

Permalink
CTP-3915 uploaded file error
Browse files Browse the repository at this point in the history
  • Loading branch information
watson8 committed Oct 14, 2024
1 parent f1baac2 commit 85a0772
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ function mod_coursework_pluginfile($course, $cm, $context, $filearea, $args, $fo
$fullpath = "/{$context->id}/mod_coursework/submission/{$submission->id}/{$relativepath}";

$fs = get_file_storage();
if (!$file = $fs->get_file_by_hash(sha1($fullpath)) || $file->is_directory()) {
$file = $fs->get_file_by_hash(sha1($fullpath));
if (!$file || $file->is_directory()) {
return false;
}
send_stored_file($file, 0, 0, true); // Download MUST be forced - security!
Expand All @@ -132,7 +133,8 @@ function mod_coursework_pluginfile($course, $cm, $context, $filearea, $args, $fo
"{$feedback->id}/{$relativepath}";

$fs = get_file_storage();
if (!$file = $fs->get_file_by_hash(sha1($fullpath)) || $file->is_directory()) {
$file = $fs->get_file_by_hash(sha1($fullpath));
if (!$file || $file->is_directory()) {
return false;
}
send_stored_file($file, 0, 0, true);
Expand Down

0 comments on commit 85a0772

Please sign in to comment.