Check for width and height before making blurhash

This commit is contained in:
Jesse Wierzbinski 2024-04-09 03:08:48 -10:00
parent bf169623c9
commit b91eb110cc
No known key found for this signature in database

View file

@ -77,7 +77,8 @@ export default apiRoute<{
? await sharp(await file.arrayBuffer()).metadata()
: null;
const blurhash = isImage
const blurhash =
isImage && metadata?.width && metadata?.height
? encode(
new Uint8ClampedArray(await file.arrayBuffer()),
metadata?.width ?? 0,