Skip to content

Attachment "view" (eye) shows a picture-icon placeholder for non-image files

DONE (origin/nightly ba5a9f79)

handleView in transactionWorkspace/AttachmentsPanel.tsx now branches on isImageFile(doc.mimeType): images keep the antd <Image> lightbox; PDFs / any non-image window.open(doc.downloadUrl, "_blank") (same as Download). tsc 0; suite 325/325.

Symptom

In a transaction's detail drawer β†’ Attachments/Receipts, clicking the eye (view) button on an attached invoice (PDF) shows a broken picture-icon placeholder instead of the file. Download works β€” it opens the real storage.googleapis.com/aote-pms.firebasestorage.app/… URL in a new tab.

Root cause (confirmed by reading the code)

components/accounting/transactionWorkspace/AttachmentsPanel.tsx: - handleView(doc) (~line 172) sets previewUrl = doc.downloadUrl and opens an antd <Image> preview regardless of file type. - antd <Image> can only render actual images; a PDF (or any non-image) has nothing to show β†’ the picture-icon placeholder. - An isImageFile(mimeType) helper already exists (~line 170, mimeType.startsWith("image/")) but handleView doesn't branch on it.

NOT a regression from the T-064 Phase 1b relocation β€” handleView / isImageFile / the <Image> preview were moved byte-for-byte; this is pre-existing behavior.

Fix (small)

Branch handleView on isImageFile(doc.mimeType): - image β†’ keep the antd <Image> preview. - non-image (PDF etc.) β†’ window.open(doc.downloadUrl, "_blank") (same as download), or render a PDF in an <iframe>/the existing payment-confirmation preview pattern.

Priority

Low β€” download is a working fallback; owner deferred it (2026-06-17) to continue T-064.

T-064 (the panel was relocated here in Phase 1b).