Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Asset URL canonicalization re-emits void block comments as '} / -->', so blocks with localized URLs are dropped

Closed Beginner friendly
#3,618 0 comments 0 reactions 0 assignees View on GitHub

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
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
php
Domain
backend, testing

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 test passes.

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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Automattic/blocks-engine

All issues in Automattic/blocks-engine

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.