aboutsummaryrefslogtreecommitdiffstats
path: root/lib/upload.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/upload.js')
-rw-r--r--lib/upload.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/upload.js b/lib/upload.js
index 9bc41388..dc311922 100644
--- a/lib/upload.js
+++ b/lib/upload.js
@@ -6,6 +6,7 @@ import path from "path";
import sharp from "sharp";
import { pipeline } from "stream";
import { g, s, db } from "$lib/db";
+import { fail } from "$lib/utils";
import crypto from "crypto";
async function getSha256Hash(stream) {
@@ -40,7 +41,7 @@ export default async (req, res) => {
let [format, ext] = (await fileTypeFromStream(s1)).mime.split("/");
if (format !== "image" && !["jpg", "jpeg", "png"].includes(ext))
- throw new Error("unsupported file type");
+ fail("unsupported file type");
let t = sharp().rotate().resize(width).webp();