From 3fc0dec9d9d0b253fe20f1306b5c7a81e0b9dd98 Mon Sep 17 00:00:00 2001 From: Usman Baig Date: Thu, 12 Mar 2026 12:31:21 +0100 Subject: [PATCH] fix: show branded icons for UA-inferred referrers instead of broken favicons Plain name referrers like "Instagram" or "WhatsApp" (inferred from User-Agent) were being passed to the favicon service as invalid domains, returning a generic globe. Now skips favicon fetch for any referrer without a dot, falling through to Phosphor icons. --- lib/utils/icons.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/utils/icons.tsx b/lib/utils/icons.tsx index bd31f15..79ccc4c 100644 --- a/lib/utils/icons.tsx +++ b/lib/utils/icons.tsx @@ -218,6 +218,8 @@ export function getReferrerFavicon(referrer: string): string | null { if (!referrer || typeof referrer !== 'string') return null const normalized = referrer.trim().toLowerCase() if (REFERRER_NO_FAVICON.includes(normalized)) return null + // Plain names without a dot (e.g. "Instagram", "WhatsApp") are not real domains + if (!normalized.includes('.')) return null try { const url = new URL(referrer.startsWith('http') ? referrer : `https://${referrer}`) if (REFERRER_USE_X_ICON.has(url.hostname.toLowerCase())) return null