diff --git a/src/app/api/[[...slugs]]/_lib/img.ts b/src/app/api/[[...slugs]]/_lib/img.ts index 3ad8b6c7..f553cdd9 100644 --- a/src/app/api/[[...slugs]]/_lib/img.ts +++ b/src/app/api/[[...slugs]]/_lib/img.ts @@ -37,7 +37,7 @@ async function img({ .resize(size || metadata.width) .toBuffer(); - return new Response(resized, { + return new Response(new Uint8Array(resized), { headers: { "Cache-Control": "public, max-age=3600, stale-while-revalidate=600", "Content-Type": "image/jpeg", @@ -45,7 +45,8 @@ async function img({ }); } catch (error) { console.error(`Gagal mengambil file dari MinIO: ${name}`, error); - return new Response(await fs.readFile(noImage), { + const buffer = await fs.readFile(noImage); + return new Response(new Uint8Array(buffer), { headers: { "Content-Type": "image/jpeg" }, }); } diff --git a/src/app/api/[[...slugs]]/route.ts b/src/app/api/[[...slugs]]/route.ts index 23a5e9f4..e3b26da0 100644 --- a/src/app/api/[[...slugs]]/route.ts +++ b/src/app/api/[[...slugs]]/route.ts @@ -1,6 +1,5 @@ import prisma from "@/lib/prisma"; import cors, { HTTPMethod } from "@elysiajs/cors"; -import { staticPlugin } from "@elysiajs/static"; import swagger from "@elysiajs/swagger"; import { Elysia, t } from "elysia"; import fs from "fs/promises";