From 57ac5c1f1a5d801edede5135012cf76224b9426e Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Thu, 6 Nov 2025 05:04:38 +0000 Subject: [PATCH] Fix pathname scope in ssrOG.ts --- api/ssrOG.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/ssrOG.ts b/api/ssrOG.ts index 9e3082ce..dda23d95 100644 --- a/api/ssrOG.ts +++ b/api/ssrOG.ts @@ -220,10 +220,12 @@ function injectOGTags(html: string, ogTags: string): string { } export default async function handler(req: VercelRequest, res: VercelResponse): Promise { + let pathname = '/'; + try { const userAgent = req.headers['user-agent'] || ''; const fullUrl = `https://${req.headers.host}${req.url}`; - const pathname = new URL(fullUrl).pathname; + pathname = new URL(fullUrl).pathname; // Comprehensive bot detection with headers const botDetection = detectBot(userAgent, req.headers as Record);