mirror of
https://github.com/versia-pub/server.git
synced 2026-01-26 12:16:01 +01:00
Check for width and height before making blurhash
This commit is contained in:
parent
bf169623c9
commit
b91eb110cc
|
|
@ -77,7 +77,8 @@ export default apiRoute<{
|
||||||
? await sharp(await file.arrayBuffer()).metadata()
|
? await sharp(await file.arrayBuffer()).metadata()
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
const blurhash = isImage
|
const blurhash =
|
||||||
|
isImage && metadata?.width && metadata?.height
|
||||||
? encode(
|
? encode(
|
||||||
new Uint8ClampedArray(await file.arrayBuffer()),
|
new Uint8ClampedArray(await file.arrayBuffer()),
|
||||||
metadata?.width ?? 0,
|
metadata?.width ?? 0,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue