GeezerVison is showing github.com — fix(web): EPUBs with a percent-encoded package path open in the file preview by only21mil · Pull Request #41540 · pingdotgg/t3code
Conversation
Problem
Opening an EPUB in the Files panel shows "This EPUB has no readable package." when its META-INF/container.xml percent-encodes the package path, for example <rootfile full-path="My%20Book/book%201.opf"/> for the entry My Book/book 1.opf. In EPUB OCF, full-path is a URI path. openEpub looked it up without decoding it, and it also used the raw value as the base for chapter hrefs, so chapters would resolve under My%20Book/ even after a decoded lookup.
Fix
openEpub resolves the package path once. It uses the decoded path (through the existing archivePath helper) when the archive has that entry, and the raw value otherwise. That resolved name is used both to read the package and as the base for chapter hrefs. If the escape is malformed (%ZZ) or the entry is literally named with a %, the raw path is used, as before. This matches the server text extractor fix in #41523.
Scope
The web preview only. Desktop uses the same web preview, mobile has no EPUB preview, and the server text extractor is fixed separately in #41523.
Testing
AI agents (Gemini 4 Neon and Claude Opus 5.5 in T3 Code) ran these checks:
- Added one
it.each next to the existing EPUB test in FilePreviewPanel.test.ts, with three rows: an encoded folder and file name, an entry literally named My%20Book/book.opf, and a malformed Book%ZZ/book.opf. The encoded row fails on 77c230e4565 with epub-no-package. It also fails with epub-no-chapters when only the lookup is decoded. It passes with the fix (48/48).
vp run check:changed passes.
- Real app before/after in the Browser panel, below.
Repro
python3 - <<'PY'
import zipfile
with zipfile.ZipFile("encoded-rootfile.epub", "w") as z:
z.writestr(zipfile.ZipInfo("mimetype"), "application/epub+zip")
z.writestr("META-INF/container.xml", '<?xml version="1.0"?><container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container"><rootfiles><rootfile full-path="My%20Book/book%201.opf" media-type="application/oebps-package+xml"/></rootfiles></container>')
z.writestr("My Book/book 1.opf", '<?xml version="1.0"?><package xmlns="http://www.idpf.org/2007/opf" version="3.0"><manifest><item id="c1" href="chapter%201.xhtml" media-type="application/xhtml+xml"/></manifest><spine><itemref idref="c1"/></spine></package>')
z.writestr("My Book/chapter 1.xhtml", '<?xml version="1.0"?><html xmlns="http://www.w3.org/1999/xhtml"><head><title>Chapter 1</title></head><body><h1>Chapter 1</h1><p>The lighthouse keeper counted ships at dawn.</p></body></html>')
PY
Run it in a project folder, start vp run dev, and open encoded-rootfile.epub from the Files panel.
Setup: Linux, Chromium (T3 Browser panel), light theme, 1280×800, fresh isolated .t3 on each commit (vp run dev --no-seed).
Steps: Files → encoded-rootfile.epub.
77c230e4565 (main) |
82e14a1a37f (this PR) |
 |
 |
| "This EPUB has no readable package." |
Chapter 1 renders. |
Not shown: desktop and mobile. Desktop wraps the same web preview; mobile has no EPUB preview.
Generated with Gemini 4 Neon in T3 Code Nightly
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Nov 23, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review.
Walkthrough
-
The web EPUB preview now tries both the normalized and original rootfile paths when locating a package. Tests cover percent-encoded, literal-percent, and malformed-percent paths.
Changes: EPUB preview path resolution
| Layer / File(s) |
Summary |
Rootfile lookup and validation apps/web/src/components/files/extendedDocumentPreview.ts, apps/web/src/components/files/FilePreviewPanel.test.ts |
openEpub checks the normalized rootfile path first and the original path if that entry is absent. Tests verify package and chapter lookup for encoded, literal-percent, and malformed-percent paths. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related PRs
- pingdotgg/t3code#41523: Fixes percent-encoded EPUB rootfile paths in the server implementation using a similar fallback.
Suggested reviewers: maria-rcks, geezoria, macroscopeapp
Merge Risk: Minimal · up to f5d2f
-
Merge Risk: ⚪ Minimal · up to f5d2f
This fixes EPUB previews for packages whose rootfile path is percent-encoded and keeps the previous behavior for literal-percent and malformed paths. No merge-blocking risk remains.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title names the main change: EPUBs whose package path is percent-encoded now open in the file preview. The title follows the conventional commit form and matches the raw summary, the description, … |
| Description check |
 |
The description follows the repository template closely. It has Problem, Fix (Change), Scope, and Testing (Verification) sections. The Problem section gives the expected behavior and the error text, a… |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
Full details: Title check
-
Explanation
The title names the main change: EPUBs whose package path is percent-encoded now open in the file preview. The title follows the conventional commit form and matches the raw summary, the description, and the objectives, which all describe a fix to openEpub's handling of percent-encoded full-path values.
Full details: Description check
-
Explanation
The description follows the repository template closely. It has Problem, Fix (Change), Scope, and Testing (Verification) sections. The Problem section gives the expected behavior and the error text, and it explains the cause. The Scope section explains why the change is limited to the web preview and cites the related server fix (#41523). The Verification section lists a focused test with its before and after results, a repro script, and a Browser-panel before/after comparison with screenshots, and it states what was not shown (desktop and mobile). The Scope section does not link a tracking issue or explain why no issue is needed, which the template asks for. The model and harness line is present. Overall the description is mostly complete.
Finishing Touches
-
Generate unit tests (beta)
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
-
Run configuration
-
Commits
-
Reviewing files that changed from the base of the PR and between f58085a and 82e14a1.
Files selected for processing: 2
-
apps/web/src/components/files/FilePreviewPanel.test.ts
apps/web/src/components/files/extendedDocumentPreview.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:XS
0-9 changed lines (additions + deletions).
vouch:unvouched
Author is not yet trusted in the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|