You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(attachments): inline PDF preview for application/pdf media blocks
Adds a `pdf` eager viewer contribution on the mime→viewer facet so an
`application/pdf` media block renders an inline, bounded-height preview
instead of the download-only file fallback.
- mediaBlock.ts: PDF_MIME + isPdfMime (case-insensitive exact match).
- mediaViewers.tsx: PdfViewer — a bounded-height <object type="application/pdf">
of the verified object URL (useAssetObjectUrl, revoked on unmount), with an
always-visible neutral octet-stream download and a can't-preview fallback
(e.g. iOS Safari). Fail-closed resolve → the broken-asset placeholder, never
an unverified source (§5.1/§7.3). Extracted a shared useLazyDownload hook so
the file fallback and PDF download reuse one octet-stream save path.
- index.ts: register pdfMediaViewer on mediaViewersFacet.
Security: the inline <object> is safe because the Blob's type is pinned to
application/pdf — the mime that selected the viewer — so the browser hands a
known non-text/* type to its PDF viewer and never HTML-sniffs
hash-verified-but-non-PDF bytes into an executable navigation; the download
stays octet-stream (matching the file-fallback posture).
Docs: design.html §11 / §15 / scope / status banner move PDF from vNext to
shipped.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S2J741JwXMwT2wGYNM1j5u
0 commit comments