mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-10-31 16:13:15 +00:00
The preview hands the attachment's blob to the browser's own viewer, which picks the viewer from the blob's type and downloads anything it cannot show - under the blob's UUID. It only corrected the exact application/octet-stream declaration from the file name. Other declarations kept the preview from working: IBM i (AS/400) systems send every attachment as application/x-as400attachment, some senders use application/x-pdf or force-download, and the octet-stream check was case-sensitive. Move the decision into previewBlobType(): a PDF, image, audio or video preview takes the first type its viewer can show - declared, then served, then the one the file name implies. Other previews keep the declared type unless it is generic, and the name never yields a script-capable type.