fix(build): resolve type errors in img.ts and cleanup route.ts
This commit is contained in:
@@ -37,7 +37,7 @@ async function img({
|
|||||||
.resize(size || metadata.width)
|
.resize(size || metadata.width)
|
||||||
.toBuffer();
|
.toBuffer();
|
||||||
|
|
||||||
return new Response(resized, {
|
return new Response(new Uint8Array(resized), {
|
||||||
headers: {
|
headers: {
|
||||||
"Cache-Control": "public, max-age=3600, stale-while-revalidate=600",
|
"Cache-Control": "public, max-age=3600, stale-while-revalidate=600",
|
||||||
"Content-Type": "image/jpeg",
|
"Content-Type": "image/jpeg",
|
||||||
@@ -45,7 +45,8 @@ async function img({
|
|||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Gagal mengambil file dari MinIO: ${name}`, 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" },
|
headers: { "Content-Type": "image/jpeg" },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import prisma from "@/lib/prisma";
|
import prisma from "@/lib/prisma";
|
||||||
import cors, { HTTPMethod } from "@elysiajs/cors";
|
import cors, { HTTPMethod } from "@elysiajs/cors";
|
||||||
import { staticPlugin } from "@elysiajs/static";
|
|
||||||
import swagger from "@elysiajs/swagger";
|
import swagger from "@elysiajs/swagger";
|
||||||
import { Elysia, t } from "elysia";
|
import { Elysia, t } from "elysia";
|
||||||
import fs from "fs/promises";
|
import fs from "fs/promises";
|
||||||
|
|||||||
Reference in New Issue
Block a user