Skip to content

[Bug]: EPUB previews decode literal entity examples inside CDATA #36594

Closed

Description

@StiensWout

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Open an EPUB containing a chapter with <pre><![CDATA[Use &amp; and &lt; literally]]></pre> in the file preview.
  2. Read the literal XML escape examples in the chapter.

The EPUB must have its usual container.xml, package manifest and spine referencing this XHTML chapter. The regression case in FilePreviewPanel.test.ts constructs this archive in memory.

Expected behavior

The preview displays Use &amp; and &lt; literally, preserving the CDATA text.

Actual behavior

It displays Use & and < literally. CDATA is merged into ordinary text and its entity examples are decoded. Output remains escaped; this report makes no markup injection claim.

Impact

Minor bug or occasional failure

Version or commit

Reproduced on pingdotgg/main at 5e06246. Independently confirmed by Claude Opus 5.5 at d2bdd58.

Environment

Web file preview; desktop shares this renderer. Technical EPUB books using XML-valid CDATA.

Logs or stack traces

The existing “reads EPUB chapters” case fails when extended with this content: expected <pre>Use &amp;amp; and &amp;lt; literally</pre>, received <pre>Use &amp; and &lt; literally</pre>.

Workaround

Use escaped ordinary XHTML text instead of CDATA for literal entity examples.

Activity

  1. added
    vouch:trusted
    on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    vouch:trusted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions