From cfb259165ea532a120fc21d159417e0568675ec5 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 10 Mar 2026 14:32:53 +0000 Subject: [PATCH] Fix bugs in packages/website: duplicate text, missing fetch validation, missing error handling - Remove duplicate sentence in blog/agent/page.tsx (copy-paste error) - Add .ok checks on fetch responses in OG image route to prevent silent failures - Add try-catch around readFileSync in changelog page to prevent crashes Co-Authored-By: Claude Opus 4.6 --- packages/website/app/api/og/route.tsx | 6 ++++++ packages/website/app/blog/agent/page.tsx | 1 - packages/website/app/changelog/page.tsx | 10 +++++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/website/app/api/og/route.tsx b/packages/website/app/api/og/route.tsx index 6e636a31b..cb907255b 100644 --- a/packages/website/app/api/og/route.tsx +++ b/packages/website/app/api/og/route.tsx @@ -11,6 +11,9 @@ const getGoogleFontUrl = (fontFamily: string, weight: number) => const fetchFont = async (fontFamily: string, weight: number) => { const cssUrl = getGoogleFontUrl(fontFamily, weight); const cssResponse = await fetch(cssUrl); + if (!cssResponse.ok) { + throw new Error(`Failed to fetch font CSS: ${cssResponse.status}`); + } const cssText = await cssResponse.text(); const fontUrlMatch = cssText.match(/src: url\(([^)]+)\)/); @@ -20,6 +23,9 @@ const fetchFont = async (fontFamily: string, weight: number) => { const fontUrl = fontUrlMatch[1]; const fontResponse = await fetch(fontUrl); + if (!fontResponse.ok) { + throw new Error(`Failed to fetch font: ${fontResponse.status}`); + } return fontResponse.arrayBuffer(); }; diff --git a/packages/website/app/blog/agent/page.tsx b/packages/website/app/blog/agent/page.tsx index 414f7c311..cfdb86ca0 100644 --- a/packages/website/app/blog/agent/page.tsx +++ b/packages/website/app/blog/agent/page.tsx @@ -497,7 +497,6 @@ const AgentPage = () => { with the agents that exist. If your tool has a CLI or an API, you can add a provider.

-

If your tool has a CLI or an API, you can add a provider.

diff --git a/packages/website/app/changelog/page.tsx b/packages/website/app/changelog/page.tsx index c9e019952..d52f1960c 100644 --- a/packages/website/app/changelog/page.tsx +++ b/packages/website/app/changelog/page.tsx @@ -39,9 +39,13 @@ export const metadata: Metadata = { }; const getChangelog = () => { - const changelogPath = join(process.cwd(), "..", "react-grab", "CHANGELOG.md"); - const content = readFileSync(changelogPath, "utf-8"); - return parseChangelog(content); + try { + const changelogPath = join(process.cwd(), "..", "react-grab", "CHANGELOG.md"); + const content = readFileSync(changelogPath, "utf-8"); + return parseChangelog(content); + } catch { + return []; + } }; const ChangelogPage = () => {