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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user