diff options
Diffstat (limited to 'lib/upload.ts')
| -rw-r--r-- | lib/upload.ts | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/upload.ts b/lib/upload.ts index 7b5ad86d..2ed5d905 100644 --- a/lib/upload.ts +++ b/lib/upload.ts @@ -16,15 +16,10 @@ export default async (req, res) => { const [format, ext] = (await fileTypeFromBuffer(buf)).mime.split("/"); - if (format !== "image" && !["jpg", "jpeg", "png"].includes(ext)) - fail("unsupported file type"); + if (format !== "image" && !["jpg", "jpeg", "png"].includes(ext)) fail("unsupported file type"); const w = type === "banner" ? 1920 : 240; - buf = await sharp(buf, { failOnError: false }) - .rotate() - .resize(w) - .webp() - .toBuffer(); + buf = await sharp(buf, { failOnError: false }).rotate().resize(w).webp().toBuffer(); const hash = createHash("sha256").update(buf).digest("hex"); |
