Parse a captured srcset with the shared comma-safe splitter - #4785
Parse a captured srcset with the shared comma-safe splitter#4785aagam-shah wants to merge 1 commit into
Conversation
|
The red |
An image-service URL can carry its transform in the path, commas and all (`/v1/fill/w_58,h_57,al_c,q_85,enc_avif,quality_auto/file.png`). retainedMediaReferencesByFamily still split such a srcset on every comma when no candidate was absolute, so it read the transform parameters as URLs instead of the candidates. Those candidates then had no local replacement: the export dropped them from the srcset and logged the fragments as uncaptured dependencies. Use srcsetReferences(), the splitter the other two srcset readers in this file already share. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wn8SVBiej94XzzDiXqtWyg
dd23234 to
cdd4723
Compare
|
Rebased onto the current tip of
The source fix itself merged clean — it is in Re-checked the defect on the new base: still reproduces. Without the fix the test gets |
There was a problem hiding this comment.
🟢 Approval recommended
The focused fix is consistent with existing parsing paths and has targeted regression coverage.
Pull request overview
Uses the existing comma-safe parser to correctly localize relative srcset URLs containing commas.
Changes:
- Reuses
srcsetReferences()for retained media detection. - Adds regression coverage for transformed image URLs.
File summaries
| File | Description |
|---|---|
capture-export.ts |
Uses the shared srcset parser. |
capture-export.test.ts |
Tests comma-containing relative candidates. |
Review details
- Files reviewed: 2/4 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Thanks @aagam-shah. Your srcset fix and regression test have been ported upstream and merged in Automattic/data-liberation-agent#171, then included in the refreshed vendor in #3952. I verified the implementation and test against your original contribution. The fix is now present in this PR’s base branch; #3952 itself remains draft and has not landed in Studio trunk. I failed to preserve your author/co-author attribution on the upstream port before merging it. That was my mistake. I have corrected the upstream PR description to credit you explicitly and link this PR and your original commit, including its original AI-assistance provenance. This does not change the already-merged DLA commit’s author metadata. Your original commit and co-author trailer remain in #3952’s history. I am closing this stacked PR as superseded by its refreshed base, not as a claim that Studio trunk has shipped the fix. AI assistance: GPT-6 Astra via OpenCode verified source/test equivalence and prepared this attribution and integration update. The earlier upstream port was performed with GPT-5.6 Terra via OpenCode. |
Stacked on
feat/site-artifact-import-cli, wherecapture-export.tslives.What breaks
An image-service URL can carry its transform in the path, commas and all:
/v1/fill/w_58,h_57,al_c,q_85,enc_avif,quality_auto/file.png. When a page uses those as relativesrcsetcandidates, the export drops every candidate but the first and logs the transform parameters (/h_57,/al_c,/q_85,/enc_avif) as uncaptured same-origin dependencies.Found while capturing
https://aagam94.wixsite.com/mysitewith the deterministic capture engine.Cause
retainedMediaReferencesByFamilyfalls back tosrcset.split(',')when no candidate is an absolute URL, so it reads the transform parameters as candidate URLs. Those real candidates then get no local replacement, and the dangling-reference pass removes them.Fix
Use
srcsetReferences(), the splitter the other two srcset readers in this file already share.How to test
npx vitest run src/lib/capture-export.test.tsinpackages/data-liberation-agent. The new test fails before the change and passes after. Committeddist/bundles were rebuilt.🤖 Generated with Claude Code