diff options
| author | Adam Soltys <[email protected]> | 2026-02-24 13:18:42 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-02-24 13:18:42 -0800 |
| commit | ad7b09b43323d0ffc0a8ddabb43e4838a184c697 (patch) | |
| tree | fbf2a59f81771b2938f474c8e7b35a497d2960e4 /lib/upload.ts | |
| parent | 9e97e040617bfa0b40150c0eba298bf186bbeeaf (diff) | |
| download | coinos-server-ad7b09b43323d0ffc0a8ddabb43e4838a184c697.tar.gz coinos-server-ad7b09b43323d0ffc0a8ddabb43e4838a184c697.zip | |
formatting
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"); |
