diff --git a/classes/local/store/object_file_system.php b/classes/local/store/object_file_system.php index 86942af6..696af9cf 100644 --- a/classes/local/store/object_file_system.php +++ b/classes/local/store/object_file_system.php @@ -178,11 +178,13 @@ protected function get_mimetype_from_hash(string $contenthash): string { // We limit 1 because multiple files can have the same contenthash. // However, they all have the same mimetype so it does not matter which one we query. - return $DB->get_field_sql('SELECT mimetype + $mimetype = $DB->get_field_sql('SELECT mimetype FROM {files} WHERE contenthash = :hash LIMIT 1', ['hash' => $contenthash]); + + return $mimetype ?? ''; } /**