Skip to content

fix(metadata): the base href in the front matter keeps its character references encoded #509

Description

@tobocop2

The front matter copies the <base href> value as written, with its character references still encoded. For <base href="https://example.com/it&#x27;s/">, the metadata holds base-href: https://example.com/it&#x27;s/ instead of https://example.com/it's/.

Where

The base extraction in the head metadata (head_metadata.rs, around line 168 in 3.14.3) reads the raw attribute bytes and stores them without decoding. Browsers decode attribute values before they use them, and the converter already decodes character references in text with the WHATWG rules.

Fix

Decode the attribute value with the same WHATWG character-reference rules before storing it, including the Windows-1252 table for numeric references 128-159. Check the other head attributes this module stores for the same defect.

Downstream

crawlberg works around this in xberg-io/crawlberg#123 by writing the resolved base unencoded before conversion. A test there fails when the converter starts decoding, so the workaround can be removed at that point.

Activity

  1. added
    bug
    rust
    on Sep 27, 2026
  2. added theissue type on Sep 27, 2026
  3. added a commit that references this issue on Sep 27, 2026
    b5f68eb
  4. added
    P3
    P1
    operator
    and removed
    P3
    on Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1bugoperatorrust

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions