You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: EPUB literal XML declarations disappear or reject preview #36623
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
Open an EPUB whose XHTML chapter includes <pre><![CDATA[<!DOCTYPE html>]]></pre>.
Inspect the code listing in the file preview. The literal DOCTYPE disappears.
Replace the listing with <pre><![CDATA[<!ENTITY author "Ada">]]></pre> and reopen the book.
The entire preview now fails. An XML comment containing a literal ENTITY example also causes the failure.
A deterministic repository repro extends the existing “reads EPUB chapters” fixture in apps/web/src/components/files/FilePreviewPanel.test.ts with those chapter fragments, then runs pnpm exec vp test run apps/web/src/components/files/FilePreviewPanel.test.ts -t 'reads EPUB chapters'.
Expected behavior
Literal XML examples in CDATA display as text, and comments do not invalidate the preview. Actual internal-subset declarations remain unsupported.
Actual behavior
The DOCTYPE listing is empty; an ENTITY listing or comment makes the panel show “No preview for this file” with “This document contains invalid or unsupported XML.” The declaration prefilter scans literal CDATA and comments as if they were declarations.
Web preview on Linux. Desktop shares the same preview parser and worker; the desktop shell was not separately exercised. Mobile does not use this preview.
Logs or stack traces
Error: This document contains invalid or unsupported XML.
Screenshots, recordings, or supporting files
Real-app scenario reproduces preview rejection on main and renders the listing with the fix.
Workaround
Encode the examples as escaped XHTML text instead of CDATA.
Activity