Asset URL canonicalization re-emits void block comments as '} / -->', so blocks with localized URLs are dropped
Maintainers usually reply within 1 day
A pull request for this has already been merged.
- #3643 by @chubes4 — merged
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
Research direction
Start in php-transformer/src/WordPressSitePlan/AssetReferenceCanonicalizer.php, where the void block comment is re-emitted, and inspect the existing canonicalizer tests for a place to add the reduced case. Add a test that canonicalizes a void block with a localized URL and confirms parse_blocks() recovers it with the rewritten URL. Done means the block parses and the full composer test suite passes.
Written by the indexing model from the issue text.
Description
Problem
AssetReferenceCanonicalizer re-emits a self-closing block comment whose attributes contained a rewritten asset URL as {…} / --> (space before -->):
return '<!-- wp:' . $opener[1] . ' ' . $encoded . ( ! empty($opener[3]) ? ' /' : '' ) . ' -->';
(php-transformer/src/WordPressSitePlan/AssetReferenceCanonicalizer.php)
WordPress' block grammar requires the void closer to be exactly /-->, so parse_blocks() no longer recognizes the block. For a core/navigation-link pointing at a localized file (a PDF), the whole saved wp_navigation menu renders empty on the front end; both footer links disappear. Any void block with a localized url/src/href is affected, and the quality report still says 0 invalid blocks.
Reduced fixture
A footer <nav> with a link to a local file:
<nav aria-label="Legal"><a href="/terms.pdf">Terms (pdf)</a><a href="/about/">About</a></nav>
(Full two-route fixture in the companion shell issue; any page with this nav and a terms.pdf file reproduces it.)
Measured: Studio create --from with Data Liberation Agent 0.33.24, Static Site Importer 1.33.174 (bundled Blocks Engine), WordPress 7.1.3. The saved wp_navigation post contains "url":"http://…/assets/…/terms.pdf","kind":"custom"} / --> and renders no links. The link without an asset URL in the same menu keeps /-->.
Expected
Rewritten void blocks serialize as <!-- wp:name {…} /-->, and the menu renders both links.
Acceptance
- A unit test that canonicalizes a void block with a localized URL and asserts
parse_blocks()recovers the block with the rewritten URL; it fails on trunk. - Full
composer testpasses.
Filed by Franklin (Claude Opus via Pi coding agent) for @chubes4 during a Data Liberation loop run. AI reduced the fixture, measured the behavior on a real Studio import, and drafted this issue.
- Dominant language
- PHP
- Stars
- 22
- Forks
- 3
- Avg merge
- 6h 51m
- Merged PRs (30d)
- 759
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Automattic/blocks-engine
-
Solved site promotion gate fails on runner PHP patch drift (expects 8.2.33, runner installs 8.2.34)Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Automattic/blocks-engine#2161 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Automattic/blocks-engine#2061 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Automattic/blocks-engine#1701 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Automattic/blocks-engine#775 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Automattic/blocks-engine#3699 ·
Maintainers usually reply within 1 day
All issues in Automattic/blocks-engine
Similar issues
-
Impact: Medium Level: Easy Type: Bug Value: Users
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
vigetlabs/wordpress-site-starter#315 ·
Maintainers usually reply within 15 days
-
PHP 8.6: bundled guzzlehttp/promises loads class `Is` → "Using "is" as a class name is deprecated"Open
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
google/site-kit-wp#14004 ·
Maintainers usually reply within 2 days
-
Awaiting Triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
jwage/phpamqplib-messenger#159 ·