add thumbnail size check

This commit is contained in:
Abhinav 2023-01-03 11:04:07 +05:30
parent fe87be3d02
commit e0c2455132

View file

@ -38,6 +38,17 @@ export async function generateThumbnail(
} else {
thumbnail = await generateVideoThumbnail(file, fileTypeInfo);
}
if (thumbnail.length > 1.5 * MAX_THUMBNAIL_SIZE) {
logError(
Error('thumbnail_too_large'),
'thumbnail greater than max limit',
{
thumbnailSize: convertBytesToHumanReadable(
thumbnail.length
),
}
);
}
if (thumbnail.length === 0) {
throw Error('EMPTY THUMBNAIL');
}