From 0d36f5f091222dfba5603c73fa890835d4e70258 Mon Sep 17 00:00:00 2001 From: diced Date: Sat, 18 Mar 2023 21:57:41 -0700 Subject: [PATCH] fix: type cast --- src/pages/api/upload.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/api/upload.ts b/src/pages/api/upload.ts index 2c553f3..704a0a0 100644 --- a/src/pages/api/upload.ts +++ b/src/pages/api/upload.ts @@ -56,7 +56,9 @@ async function handler(req: NextApiReq, res: NextApiRes) { } const rawFormat = ((req.headers['format'] as string) || zconfig.uploader.default_format).toLowerCase(); - const format = NameFormats.includes(rawFormat as NameFormat) ? rawFormat : 'random'; + const format = NameFormats.includes(rawFormat as NameFormat) + ? (rawFormat as NameFormat) + : ('random' as NameFormat); const imageCompressionPercent = req.headers['image-compression-percent'] ? Number(req.headers['image-compression-percent'])