From 98b03415c0f25ad87b0cfa9e2ea32f347f8b693e Mon Sep 17 00:00:00 2001 From: David Bogner Date: Tue, 23 Jan 2024 12:58:43 +0100 Subject: [PATCH] Fix file API integration --- lib.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib.php b/lib.php index 65fe67a5..7c9328da 100644 --- a/lib.php +++ b/lib.php @@ -580,12 +580,13 @@ function mod_datalynx_pluginfile($course, $cm, $context, $filearea, $args, $forc $oldpath = "/$context->id/mod_dataform/$filearea/$contentid/$relativepath"; $fs = get_file_storage(); - if (!$file = $fs->get_file_by_hash(sha1($fullpath)) || $file->is_directory()) { - if (!$file = $fs->get_file_by_hash(sha1($oldpath)) || $file->is_directory()) { + $file = $fs->get_file_by_hash(sha1($fullpath)); + if (!$file || $file->is_directory()) { + $file = $fs->get_file_by_hash(sha1($oldpath)); + if (!$file || $file->is_directory()) { return false; } } - // Finally send the file. send_stored_file($file, 0, 0, false); // Download MUST be forced - security! }