GeezerVison is showing github.com — fix(server): EPUB chapters with a query in their href extract their text by only21mil · Pull Request #41553 · pingdotgg/t3code
Conversation
Problem
When an EPUB attachment's manifest gives a chapter href with a query, for example <item href="a.xhtml?x=1"/> for the entry a.xhtml, the agent gets no text for that chapter, only [Skipped document part: a.xhtml?x=1 (missing or invalid XML).]. A manifest href is a URL, and its query is not part of the file name. The server's text extractor already removed the #fragment but kept the ?query.
Change
documentTextWorker.ts now removes both before decoding: href.split(/[?#]/, 1)[0], the same way the web EPUB preview (archivePath in extendedDocumentPreview.ts) already reads these hrefs. A ? or # that is part of a file name is percent-encoded in the href (%3F, %23), so it still decodes to the literal character. One case is added to the existing EPUB table in userInputAttachments.test.ts.
Scope
This is a small bug fix with no issue, and it only changes the server. One case changes on purpose: an entry with a literal ? before its extension, such as a?x=1.xhtml, is no longer found through the unencoded href a?x=1.xhtml. A valid href writes it as a%3Fx=1.xhtml, which still works, and the web preview already behaves this way.
Verification
An AI agent ran each check on Linux with no accounts.
Setup: Linux x86_64, Node 26.13.1, a synthetic EPUB whose package lists <item href="a.xhtml?x=1"/>, with the entry OEBPS/a.xhtml.
Steps: node apps/server/src/bin.ts __document-text query-href.epub .epub (the same worker entrypoint the server starts for attachments)
f58085a1c2e5 (main) |
8417089e8a52 (this PR) |
## Chapter 1
[Skipped document part: OEBPS/a.xhtml?x=1 (missing or invalid XML).] |
## Chapter 1
The lighthouse keeper counted ships at dawn. |
vp test run apps/server/src/provider/userInputAttachments.test.ts: the new case (q%3F1.xhtml?x=1 and chapter%201.xhtml?v=2#sec1) fails on main (both chapters become skip notes) and passes with this change (53/53).
vp run check:changed: passes.
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 EPUB worker now removes a query string or fragment from a chapter href before percent-decoding it. A test covers an href with an encoded question mark and query and fragment suffixes.
Changes: EPUB chapter href handling
| Layer / File(s) |
Summary |
Strip suffixes before decoding apps/server/src/provider/documentTextWorker.ts, apps/server/src/provider/userInputAttachments.test.ts |
The worker removes a query string or fragment before decoding an EPUB chapter href. The test checks that the matching chapter text is extracted without skipped-part or truncation markers. |
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix
Suggested reviewers: lucenx9, marve10s
Merge Risk: Minimal · up to 4279c
-
EPUB chapters whose manifest hrefs carry query strings or fragments are now extracted instead of skipped. The fix is small and has a test covering an encoded question mark with suffixes. No merge-blocking risk remains.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title names the fix (EPUB chapters whose href contains a query now extract their text) and the server scope. It matches the main change in documentTextWorker.ts, which now strips the query string … |
| Description check |
 |
The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section gives the expected behavior and the observed skip note for an href such as a.xhtml?x… |
| 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 fix (EPUB chapters whose href contains a query now extract their text) and the server scope. It matches the main change in documentTextWorker.ts, which now strips the query string or fragment from chapter hrefs before decoding, and the added test case. It follows the conventional commit form in the template.
Full details: Description check
-
Explanation
The description follows the template. It has Problem, Change, Scope, and Verification sections. The Problem section gives the expected behavior and the observed skip note for an href such as a.xhtml?x=1. The Change section explains the split-and-decode approach and the percent-encoding case. The Scope section says it is a small bug fix with no issue, and it states the intentional behavior change for unencoded literal '?' names. The Verification section gives the commands, the environment, a before/after comparison, and the test results. It does not link an issue, but the author explains why none is needed, which the template allows. The agent-model line is present. The description is complete and specific.
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 8417089 and 4279cae.
Files selected for processing: 1
-
apps/server/src/provider/userInputAttachments.test.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.
Evidence
Attach the same synthetic EPUB on fresh databases and ask a deterministic ACP reader to quote the server-generated extracted text. Exercise query, plain, fragment, and percent-encoded question-mark hrefs. Linux Chromium, 1280×800, light theme. Recordings begin after pairing.
Scenario: EPUB query href chapters reach the agent without losing literal encoded question marks
Proven: the scenario fails on base 7182abeeaa and passes on head 4279caec81.
Scenario source, including synthetic EPUB fixture and deterministic reader.
Not shown:
- Codex GPT-6-Luna's natural-language response was not repeated; a deterministic ACP reader quoted the actual server-generated extracted sidecar to isolate the provider-independent extraction defect.
|
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.
|