From 8f04e0722d6d8ef3933e63adcfac64aa1c01a736 Mon Sep 17 00:00:00 2001 From: log101 Date: Thu, 22 Feb 2024 17:21:22 +0300 Subject: [PATCH] feat: add content type metadata --- src/pages/api/content/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/api/content/index.ts b/src/pages/api/content/index.ts index 225f94f..f7d60c6 100644 --- a/src/pages/api/content/index.ts +++ b/src/pages/api/content/index.ts @@ -38,7 +38,7 @@ export const POST: APIRoute = async ({ request }) => { const randomImageId = nanoid() - const imageName = `${image.name.replace(/\.[^/.]+$/, "")}${randomImageId}.jpg` + const imageName = `${image.name.replace(/\.[^/.]+$/, "")}${randomImageId}.webp` const imageBuf = await image.arrayBuffer() @@ -50,7 +50,8 @@ export const POST: APIRoute = async ({ request }) => { const { error } = await supabase.storage.from("images").upload(`public/${imageName}`, data, { cacheControl: "3600", - upsert: false + upsert: false, + contentType: "image/webp" }) if (error) {