Repository navigation
Conversation
…ader A previewed HTML page's @font-face files (.woff2/.woff/.ttf/.otf) came back from readAuthorizedDocPreviewFile as an empty, untyped binary, which the orca-preview protocol turns into a 415 unsupported-asset. Type them like images and PDFs so their bytes are returned. Fixes stablyai#26614 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…e refused by design Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
7c212df to
ec37957
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (4)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe preview reader now classifies Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The change enables local font resources in document previews, and the inspected runtime and SSH paths pass and serve them without filtering. No concrete merge-blocking issue remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Records the retained adapted contribution from #26629 in replacement PR #26849. Co-authored-by: noan98 <[email protected]>
|
Thanks @noan98 for tracking this down! This is already fixed on main by #26849 (38aa54f): |
ELI5
When Orca previews an HTML page that lives on a remote machine, the page's custom fonts were not sent along, so the page fell back to system fonts and showed "files could not be loaded". Now fonts are sent the same way images are.
What Changed
Before: opening a local HTML file in the document preview on a runtime (or SSH) workspace showed "4 files in this document could not be loaded", and every
@font-face(.woff2,.woff,.ttf,.otf) failed with a 415unsupported-asset.After: those font files load and the page renders with its own fonts.
Mechanism:
readAuthorizedDocPreviewFile(src/shared/doc-preview-file-access.ts) only returns bytes for extensions in its binary MIME table (images + PDF). Any other binary comes back as empty content with no type, whichtoOutcomeindoc-preview-file-reader.tscorrectly reports as 415. The protocol's content-type table and CSP (font-src 'self' data:) already expect fonts, so the gap was only in the reader table. This adds the four font types there.Why
The reader table is the single place that decides which binaries a host is willing to send, and both the runtime (
files.readDocPreview) and the SSH relay (fs.readDocPreview) use it, so one entry fixes both. The native-chat attachment store also calls this reader but gates on image extensions first, so it is unaffected.Wire compatibility: an older host still answers with no type, and the client keeps reporting that as
unsupported-assetexactly as before; a newer host answering an older client sends base64 +mimeType, which older clients already decode. The comment that said fonts are refused "by design" on SSH is updated to describe that older-host case instead.Linked Issue
Fixes #26614
Visual Proof
N/A: this is a host-side reader change; I could not run the Electron app with a paired runtime in my environment. The behavior is covered by a unit test that reads real font files through the reader.
Testing
vitest run src/shared/doc-preview-file-access.test.ts src/main/browser/doc-preview-file-reader.test.ts src/main/browser/doc-preview-protocol.test.ts: 48 passed. The new test fails without the change.tsc --noEmit -p config/tsconfig.node.json: passes.oxlintandoxfmton the changed files: clean.Tested on Linux only (unit tests); not manually tested in the app.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Written with Claude Code (Anthropic) and reviewed by the submitter.
Review
Agent skill upstream boundary
Notes
Security: only adds four font MIME types to an already-authorized, size-capped read; path authorization is unchanged. Cross-platform: no platform-specific code. SSH: the relay picks up the same table on its next upload.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)