Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Return 404 when OG program group is missing

Kiran K2867c0e6f6fb
diff --git a/apps/web/app/api/og/program/route.tsx b/apps/web/app/api/og/program/route.tsx
index f58b415b00..7086615234 100644
--- a/apps/web/app/api/og/program/route.tsx
+++ b/apps/web/app/api/og/program/route.tsx
@@ -15,6 +15,7 @@ const DARK_CELLS = [
[53, 1],
];
+// GET /api/og/program?slug=program&groupSlug=group
export async function GET(req: NextRequest) {
const slug = req.nextUrl.searchParams.get("slug");
const groupSlug = req.nextUrl.searchParams.get("groupSlug");
@@ -47,13 +48,19 @@ export async function GET(req: NextRequest) {
]);
if (!program) {
- return new Response(`Program not found`, {
+ return new Response("Program not found", {
status: 404,
});
}
const group = program.groups[0];
+ if (!group) {
+ return new Response("Group not found", {
+ status: 404,
+ });
+ }
+
const logo = group.wordmark || group.logo;
const brandColor = group.brandColor || "#000000";