fix(embed): send document buffer as base64 to avoid ArrayBuffer loss in embedded WebViews (#113) - #115
Open
chaxus wants to merge 1 commit into
Open
fix(embed): send document buffer as base64 to avoid ArrayBuffer loss in embedded WebViews (#113)#115chaxus wants to merge 1 commit into
chaxus wants to merge 1 commit into
Conversation
…in embedded WebViews (#113) document:open-buffer had no support for base64-encoded payloads, the only transport a host like Qt WebEngine's runJavaScript() can use to hand over binary data. Separately, asc_openDocument sent binData as a raw ArrayBuffer through OnlyOffice's internal iframe postMessage, which relies on the host's structured-clone support for binary types. Send it as base64 instead, mirroring the already-working empty "new document" template path, which sidesteps that dependency entirely. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Deploying document with
|
| Latest commit: |
18bb045
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://b4dfe7f8.document-7hm.pages.dev |
| Branch Preview URL: | https://fix-issue-113-embed-buffer-b.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.
Summary
document:open-bufferhad no support for base64-encoded payloads, the only transport a host like Qt WebEngine'srunJavaScript()can use to hand over binary data (JSON-only bridge).asc_openDocumentsent the converted document buffer as a rawArrayBuffer/Uint8Arraythrough OnlyOffice's internal editor iframe viapostMessage, which relies on the host's structured-clone support for binary types. Some embedded WebViews (reported: Qt WebEngine / PySide6) appear to lose that data in transit, which OnlyOffice's engine then can't recognize and reports as a format mismatch (errorCode -85).lib/empty_bin.ts), which sidesteps ArrayBuffer structured-clone entirely since strings always survivepostMessage.document:open-bufferpayloads (with optionaldata:...;base64,prefix stripping).Full root-cause writeup:
docs/explorations/2026-08-04-issue-113-embed-buffer-format-mismatch.md.Caveat
I don't have a Qt WebEngine environment to reproduce this end-to-end, so this fix is based on static analysis of the vendored OnlyOffice SDK + the working "new document" precedent, not a confirmed live repro. All existing behavior (real browsers, the empty-template path) is unit-tested and unchanged.
Test plan
pnpm run lint:ts(oxlint + tsc)pnpm run format:checkpnpm run test:coverage— 263 tests pass, incl. 4 new cases covering base64 payload decoding and theasc_openDocumentbuf formatCloses #113 (pending confirmation).
🤖 Generated with Claude Code