diff --git a/lib.php b/lib.php index 9800f1c997cf650850b3e6b9f4764f854acdfb37..1031060fa8ec18e59ef5df2a76f544b1472ee5ed 100644 --- a/lib.php +++ b/lib.php @@ -425,12 +425,12 @@ function pdfannotator_pluginfile($course, $cm, $context, $filearea, $args, $forc if ($filearea === 'post') { $commentid = 0; foreach ($args as $param) { - if ($DB->record_exists('pdfannotator_comments', ['id' => $param])) { + if (is_int($param) && $DB->record_exists('pdfannotator_comments', ['id' => $param])) { $commentid = $param; break; } } - + $fullpath = rtrim("/$context->id/mod_pdfannotator/$filearea/$commentid/$relativepath", '/'); if (!$file = $fs->get_file_by_hash(sha1($fullpath)) or $file->is_directory()) { //Annotations from other documents might have another contextid.