From abb63011566afa3255cfef5f3454a9d250e5cb72 Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Fri, 10 Apr 2026 18:10:30 +0200 Subject: [PATCH] Clean `amp;` prefixes from search parameters in `og/profile.tsx` to resolve URL encoding issues; add debug --- web/pages/api/og/profile.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/web/pages/api/og/profile.tsx b/web/pages/api/og/profile.tsx index 7a12bfc8..cbeaba08 100644 --- a/web/pages/api/og/profile.tsx +++ b/web/pages/api/og/profile.tsx @@ -22,6 +22,7 @@ function capitalize(str: string) { } function OgProfile(props: ogProps) { + console.log(props) const {avatarUrl, name, city, country, age, interests, keywords} = props let headline = props.headline @@ -167,7 +168,13 @@ export default async function handler(req: NextRequest) { try { const {searchParams} = new URL(req.url) const options = await getCardOptions() - const ogProps = Object.fromEntries(searchParams.entries()) as ogProps + + // Clean search params by removing 'amp;' prefixes that occur due to URL encoding + const cleanedEntries = Array.from(searchParams.entries()).map(([key, value]) => [ + key.replace(/^amp;/, ''), + value, + ]) + const ogProps = Object.fromEntries(cleanedEntries) as ogProps const image = OgProfile(ogProps) return new ImageResponse(classToTw(image), options as ImageResponseOptions)