fix: type cast

This commit is contained in:
diced 2023-03-18 21:57:41 -07:00
parent 3d5cdf50e6
commit 0d36f5f091
No known key found for this signature in database
GPG key ID: 370BD1BA142842D1

View file

@ -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'])