Repository navigation
fix(editor): the x2t proxy must not fetch a document as if it were a URL - #231
Merged
Merged
Conversation
Found reviewing today's changes. Guard 14 turns whatever the vendor passes into bytes before sending it to the worker, and for strings it fetched unconditionally. x2t_helper's own handleFileData does not: it sorts strings into DataURL / BlobURL / FileURL / HttpURL / URL *and* String, and that last case is not an error -- it encodes the text as UTF-8 bytes. So a document handed over as text -- the empty-document template the offline patch uses, or the latin1 DOCY form of #113 -- would have been requested as a relative URL instead of converted. Strings that are not locations now cross untouched, and the worker's own handleFileData decides, exactly as it did before conversion moved out of the frame. Same rule for media entries. looksLikeUrl is exported for the unit test on purpose: it mirrors a classifier in vendor code that this proxy has to agree with, and getting it wrong turns a document into a request. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MKNHFQ1kek1cHeqhbH37Pk
chaxus
enabled auto-merge (rebase)
September 12, 2026 12:36
Deploying document with
|
| Latest commit: |
20b4711
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://73b563f4.document-7hm.pages.dev |
| Branch Preview URL: | https://fix-x2t-proxy-string-input.document-7hm.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Found while reviewing today's changes.
Guard 14 (#224) turns whatever the vendor passes into bytes before sending it to the x2t worker. For strings it fetched unconditionally.
x2t_helper's ownhandleFileDatadoes not — it sorts strings intoDataURL/BlobURL/FileURL/HttpURL/URLandString, and that last case is not an error:So a document handed over as text — the empty-document template the offline patch uses (
DOCY;v5;7372;…), or the latin1 DOCY form #113 was about — would have been requested as a relative URL instead of converted.Fix
Strings that are not locations cross untouched, and the worker's own
handleFileDatadecides, exactly as it did before conversion moved out of the frame. Same rule for media entries.looksLikeUrlis exported for the unit test on purpose: it mirrors a classifier in vendor code that this proxy has to agree with, and getting it wrong turns a document into a request — pinning it directly is cheaper than reaching it through a conversion.Re-ran the conversion-heavy specs (multi-sheet xlsx, CSV round trip, GBK CSV, PDF annotate + save, CJK PDF export, the offline seam): all green.
🤖 Generated with Claude Code
https://claude.ai/code/session_01MKNHFQ1kek1cHeqhbH37Pk