mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-15 12:11:01 +08:00
fix(og-images): wrap Buffer in Uint8Array for Response body (#568)
Astro uses Web API typings; Response doesn’t accept Node Buffer. Convert the generated OG image Buffer to Uint8Array before constructing Response to satisfy BodyInit and fix the build/type error. Closes #560
This commit is contained in:
+4
-2
@@ -1,7 +1,9 @@
|
||||
import type { APIRoute } from "astro";
|
||||
import { generateOgImageForSite } from "@/utils/generateOgImages";
|
||||
|
||||
export const GET: APIRoute = async () =>
|
||||
new Response(await generateOgImageForSite(), {
|
||||
export const GET: APIRoute = async () => {
|
||||
const buffer = await generateOgImageForSite();
|
||||
return new Response(new Uint8Array(buffer), {
|
||||
headers: { "Content-Type": "image/png" },
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user