From 1e385a8fcc1ac940b320fef2758a34086bb27f4d Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Wed, 1 May 2024 16:43:28 +1200 Subject: [PATCH] Fix #132 - get $file before trying to check it. --- lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib.php b/lib.php index da97b11..a559598 100644 --- a/lib.php +++ b/lib.php @@ -451,7 +451,8 @@ function dialogue_pluginfile($course, $cm, $context, $filearea, $args, $forcedow $fs = get_file_storage(); $relativepath = implode('/', $args); $fullpath = "/$context->id/mod_dialogue/$filearea/$itemid/$relativepath"; - 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; }