From 1c72622db8ccb177f896928036b680eae93475cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Fri, 15 May 2026 21:59:30 -0400 Subject: [PATCH] Resolve favicons through Google's s2 service MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pointing the renderer at the site's own `/favicon.ico` was producing GPUI image-cache errors on every other tab — notion.com redirected across origins, sites shipped multi-image `image/x-icon` blobs the PNG/WebP decoder couldn't read, hosts 404'd. Each one logged a noisy `ERROR gpui::asset_cache: Failed to load asset` line. Switch `UrlText::favicon_url` to `https://www.google.com/s2/favicons?domain=&sz=64`. Google's endpoint normalises every response to PNG, follows redirects on its side, and serves a `_/` globe glyph for sites without a favicon at all — same URL shape every browser dev-tools panel already shows for "favicon" so the fetch is uniformly succeeding. --- crates/ely_domain/src/url_text.rs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/crates/ely_domain/src/url_text.rs b/crates/ely_domain/src/url_text.rs index fcbc625..6b51c60 100644 --- a/crates/ely_domain/src/url_text.rs +++ b/crates/ely_domain/src/url_text.rs @@ -72,18 +72,29 @@ impl UrlText { url.host_str().map(str::to_string).unwrap_or_else(|| self.value.clone()) } - /// Resolve the canonical `/favicon.ico` URL for an HTTP(S) page. - /// Returns `None` for non-web schemes (`ely://`, `file://`, etc.) - /// or URLs missing an authority — those tabs render the URL-derived - /// glyph instead of a fetched icon. + /// Resolve a favicon URL for an HTTP(S) page. Returns `None` for + /// non-web schemes (`ely://`, `file://`, …) and for URLs missing + /// an authority — those tabs render the URL-derived glyph instead. + /// + /// We deliberately do NOT point the renderer at the site's own + /// `/favicon.ico` because a) many sites only ship that icon as + /// a multi-image `image/x-icon` blob the renderer's PNG/WebP + /// decoder can't read, and b) the URL frequently 404s or + /// redirects across origins (notion.com → notion.so etc.) which + /// the GPUI image fetcher surfaces as a noisy `ERROR` log on + /// every tab. Instead we route through Google's `s2/favicons` + /// endpoint: it normalises the response to PNG, resolves + /// redirects on Google's side, and serves a `_/` globe glyph + /// when the target site has no favicon at all. Same URL shape + /// every browser dev-tools panel already shows for "favicon". #[must_use] pub fn favicon_url(&self) -> Option { let url = Url::parse(&self.value).ok()?; if !matches!(url.scheme(), "http" | "https") { return None; } - url.host_str()?; - url.join("/favicon.ico").ok().map(|favicon| favicon.to_string()) + let host = url.host_str()?; + Some(format!("https://www.google.com/s2/favicons?domain={host}&sz=64")) } }