GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

@only21mil

@only21mil only21mil commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

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)
The Files panel shows "No preview for this file. This EPUB has no readable package." The Files panel shows Chapter 1 of 1: "The lighthouse keeper counted ships at dawn."
"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.

All reactions
@only21mil
fix(web): EPUBs with a percent-encoded package path open in the file …
82e14a1
…preview
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 23, 2026
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Explain Change →

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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed 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 Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed 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)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: pingdotgg/t3code
  • Branch: main
  • File: .coderabbit.config.ts
  • Commit: f58085a
  • Layers: Repository TS config
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f7110c87-7b32-4676-a12d-303515c3275b
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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 23, 2026
@juliusmarminge @claude
Merge branch 'main' into fix/web-epub-encoded-rootfile
f5d2fd4
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@juliusmarminge

juliusmarminge commented Nov 23, 2026

Copy link
Copy Markdown
Member

Evidence

Open a seeded thread → right panel → Files. Open plain, literal-percent, malformed-percent, then encoded-rootfile EPUBs. Chromium, 1280×800, light theme; fresh synthetic state on each commit.

Proven: the scenario fails on base and passes on head. Base shows the unreadable-package error; head renders the lighthouse-keeper chapter. All three controls render on both commits.

Preview Before: f58085a1c2 After: f5d2fd458e
Encoded rootfile Before: unreadable package After: chapter renders
Plain control Before: plain After: plain
Literal percent Before: literal percent After: literal percent
Malformed percent Before: malformed percent After: malformed percent

Before recording · After recording

Scenario and fixture generator

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 23, 2026
@juliusmarminge
juliusmarminge merged commit 9904124 into pingdotgg:main Nov 23, 2026
56 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 23, 2026
@patroza patroza mentioned this pull request Nov 24, 2026
Merge upstream main through 2fe7febc8d73 patroza/t3code#671
Merged
@drenkas drenkas mentioned this pull request Nov 24, 2026
Sync upstream 2fe7febc8d73 drenkas/sigma-t3#30
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

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.

Projects

None yet

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.

2 participants

@only21mil @juliusmarminge
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.