From c1613d8a21c18ce218fbe31c4ff0f187e1220827 Mon Sep 17 00:00:00 2001 From: 96528025 Date: Wed, 18 Mar 2026 14:45:08 -0700 Subject: [PATCH] fix: guard HTTP failure responses and rename res to response - Rename `res` to `response` to follow no-abbreviation naming guideline - Add `response.ok` check to throw on non-2xx status codes, preventing error page content from being silently copied to the clipboard Co-Authored-By: Claude Sonnet 4.6 --- apps/web/src/components/header.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/header.tsx b/apps/web/src/components/header.tsx index 7eb3c9cd..64d42471 100644 --- a/apps/web/src/components/header.tsx +++ b/apps/web/src/components/header.tsx @@ -68,8 +68,11 @@ export function Header() { { try { - const res = await fetch(DEFAULT_LOGO_URL); - const svg = await res.text(); + const response = await fetch(DEFAULT_LOGO_URL); + if (!response.ok) { + throw new Error(`Failed to fetch SVG: ${response.status}`); + } + const svg = await response.text(); await navigator.clipboard.writeText(svg); toast.success("SVG copied to clipboard"); } catch {