fix for file extension not supported

- the error occured with jfif extension, which is essentially a jpeg file
This commit is contained in:
Damodar Lohani
2023-12-28 01:31:25 +00:00
parent 0fdc28e034
commit e8ff828039
+6
View File
@@ -915,6 +915,12 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/preview')
}
if (empty($output)) {
// when file extension is provided but it's not one of our
// supported outputs we fallback to `jpg`
if(!empty($type) && !array_key_exists($type, $outputs)) {
$type = 'jpg';
}
// when file extension is not provided and the mime type is not one of our supported outputs
// we fallback to `jpg` output format
$output = empty($type) ? (array_search($mime, $outputs) ?? 'jpg') : $type;