From e2a4d16942daa9edc0f0a254758c609442d23240 Mon Sep 17 00:00:00 2001 From: Vithusha Kethiri Date: Fri, 24 Jan 2025 14:11:23 +1100 Subject: [PATCH] fix: update string handling in mimetype in objectfs manipulator --- classes/local/store/object_file_system.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/classes/local/store/object_file_system.php b/classes/local/store/object_file_system.php index 86942af6..8dc04fe9 100644 --- a/classes/local/store/object_file_system.php +++ b/classes/local/store/object_file_system.php @@ -178,11 +178,12 @@ 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 !empty($mimetype) ? $mimetype : ''; } /**