Skip to content

fix(cli): #1709 guard frontmatter title/label/id decode so a literal % cannot crash the build#1710

Open
jstockdi wants to merge 1 commit into
ProjectEvergreen:masterfrom
Battle-Creek-LLC:bug/issue-1709-frontmatter-decode-guard
Open

fix(cli): #1709 guard frontmatter title/label/id decode so a literal % cannot crash the build#1710
jstockdi wants to merge 1 commit into
ProjectEvergreen:masterfrom
Battle-Creek-LLC:bug/issue-1709-frontmatter-decode-guard

Conversation

@jstockdi

Copy link
Copy Markdown
Contributor

Related Issue

Resolves #1709

Documentation

N/A — no user-facing documentation changes (bug fix only).

Summary of Changes

  1. Added a small safeDecodeURIComponent helper in
    packages/cli/src/lifecycles/graph.js that wraps decodeURIComponent in a
    try/catch and returns the original string on URIError.
  2. Used it for the page id, label, and title decodes so valid
    percent-encoded filenames still decode, but a literal % in frontmatter
    (e.g. 100% Complete, Save 20%) can no longer crash the build.
  3. Added a regression test case
    packages/cli/test/cases/build.default.frontmatter-percent/ with a fixture
    page whose frontmatter title/label contain %, asserting the build succeeds
    and the title reaches the output verbatim.
  4. No breaking changes — valid percent-encoded filenames decode exactly as
    before; only the previously-fatal malformed-input path now falls back to the
    raw string.

…de so a literal % cannot crash the build
@jstockdi jstockdi self-assigned this Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Frontmatter title or label containing a percent sign crashes the build (URIError)

1 participant