Repository navigation
fix(server): resolve a later local project favicon when an earlier icon link is not a local file - #42023
Conversation
…on link is not a local file
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…llback-later-icon-link
Keeps the exported optionOnNotFound unchanged for AssetAccess and drops a colon-path test the scheme check could not break. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EvidenceScenario: Later local icons survive earlier unsupported icon linksCreated the three reported synthetic git projects, each containing the same red/yellow SVG. Seeded Replay (dev) multi-turn threads, opened each thread, inspected sidebar and breadcrumb icons, then opened the Projects picker. Environment: Linux Chromium, 1280×800, light theme, fresh isolated databases on both commits. Proven: the scenario fails on base 110ed776c9 and passes on head f4ebe39f47.
Before recording · After recording Not shown:
|



Problem
When a project's
index.htmlor root route file lists adata:icon, anhttps:icon, or a missing file before a local icon such as<link rel="icon" href="/brand/logo.svg">, the project shows its letter monogram instead of that icon. The resolver tried only the first icon href. A long base64data:icon also madestatfail withENAMETOOLONG, which errored the whole lookup.Change
The resolver now collects every icon href in document order (HTML
<link>tags first, then route object literals, as before) and uses the first one that names an existing file in the workspace, so an earlier existing icon still wins. Hrefs with a URL scheme (data:,https:) or a protocol-relative//hostare skipped, since they never name a project file. A path that runs through a file (ENOTDIR) or a symlink loop now counts as missing, asNotFoundalready did, whether it is a candidate, a source file, or a cached icon checked again. That applies to every favicon candidate, not just source hrefs.Scope
A small fix for an obvious server bug in
ProjectFaviconResolver.ts, so it has no issue. No client or contract changes.Verification
Setup: Linux, web client in T3 Code's Browser panel at 1280×800, light theme, a fresh dev server process (
vp run dev --no-seed) and browser origin for each commit, server labelled "Test machine". TheBrand Demofixture'sindex.htmllists a percent-encodeddata:SVG icon, anhttps:icon, then/brand/logo.svg, withpublic/brand/logo.svgpresent and nofavicon.*file.Steps: add the fixture project → start a Replay (dev) thread in it → open the thread.
c9e22e5ff42(main)ae84e41b005(this PR)An AI agent ran
vp test run src/project/ProjectFaviconResolver.test.ts. The updated cases fail onc9e22e5ff42(the HTML case withENAMETOOLONG, the route case finds no icon) and pass 3 of 3 runs onae84e41b005. They also pass on a local merge with main ata891304c84b, which merges cleanly and leaves both changed files identical.vp run check:changedpasses.What the tests cover
index.htmllisting a 5,000-character base64data:icon, anhttps:icon, a missing file, a//hosticon that matches a local file, and a path through a file, then/brand/logo.svgand a later existing/brand/late.svg. It resolveslogo.svg. Whenpublicthen becomes a file, the next lookup falls back toweb/favicon.pnginstead of failing.https:icon before a local one./brand:v2.svg, which stays a path (skipped on Windows, where:is not allowed in file names).//check or theENOTDIRskip for a candidate, a source file or a cached icon is removed, if either href list stops at its first entry, if candidates are tried in reverse, or if the scheme check runs after the leading/is stripped.Links
ProjectFaviconResolver.tsand its testNot shown
ENAMETOOLONGerror from a long base64data:icon is shown by the test only.Generated with Claude Opus 5.5 in T3 Code Nightly