fix(build): resolve type errors in img.ts and cleanup route.ts

This commit is contained in:
2026-04-23 13:52:57 +08:00
parent 55d0735fcf
commit 437e9aa13c
2 changed files with 3 additions and 3 deletions

View File

@@ -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" },
});
}

View File

@@ -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";