We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bb23d9f commit 143dd80Copy full SHA for 143dd80
1 file changed
apps/web/src/app/api/github-image/route.ts
@@ -38,17 +38,16 @@ export async function GET(request: NextRequest) {
38
repo,
39
path,
40
...(ref ? { ref } : {}),
41
- mediaType: { format: "raw" },
42
});
43
+ if (Array.isArray(data) || !("content" in data) || !data.content) {
44
+ return NextResponse.json({ error: "Image not found" }, { status: 404 });
45
+ }
46
+
47
+ const buffer = Buffer.from(data.content, "base64");
48
const ext = path.split(".").pop()?.toLowerCase() || "";
49
const contentType = MIME_TYPES[ext] || "application/octet-stream";
50
- const buffer =
- typeof data === "string"
- ? Buffer.from(data, "binary")
- : Buffer.from(data as unknown as ArrayBuffer);
51
-
52
return new NextResponse(buffer, {
53
headers: {
54
"Content-Type": contentType,
0 commit comments