Repository navigation
fix(cli): capture images declared only through srcset - #5298
Conversation
jrusso1020
left a comment
There was a problem hiding this comment.
Verified the bug is still live on main: the image pass in assetCataloger.ts still selects only img[src], so an <img> declared purely through srcset never reaches the existing srcset split. Widening the selector to img[src], img[srcset] is the minimal fix, and it is safe for srcset-only elements because img.src is the empty string there and add() already drops empty URLs, so no bogus page-URL asset appears. The new happy-dom tests drive the real catalogAssets script (made possible by narrowing the parameter to Pick<Page, "evaluate">, which every caller still satisfies) and cover srcset-only candidates, Next.js variant dedup keeping the largest width, src/srcset merging, and the no-source <picture> img case. Need: yes · Size: ok · Reuse: uses the existing srcset loop and dedup · Simpler: already minimal.
— Rames
Website capture skips
<img>elements whose images are declared only throughsrcset, leaving valid image candidates out of the asset catalog. Include images with eithersrcorsrcsetin the existing discovery pass. Preserve DOM context, image descriptions, optimized-variant deduplication, and<picture>source handling.The merge with current
mainretains its validated network transport for GIF metadata, public redirect handling, and refusal of private-address redirects.Validation
The published tree matches the tested tree, and all newly published commits have verified GitHub signatures.