feat: Preview PDF attachments in the modal#81
Open
akrost wants to merge 1 commit intoRasalas:mainfrom
Open
Conversation
- Treat .pdf files with generic binary MIME as previewable (fixes download/Save As on row click) - Render PDF preview via Blob URL in object; revoke on navigation and close - Remove Tauri system-viewer PDF bypass and open_file_with_system command - Mock URL.createObjectURL in Jest setup; update tests and AGENTS.md Made-with: Cursor
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
Clicking a PDF attachment now opens the in-app preview modal (same as images and text), instead of triggering an immediate browser download or opening an external viewer on desktop.
Changes
*.pdffiles with empty,application/octet-stream, orbinary/octet-streamMIME are treated as PDFs so the attachment row uses "preview" instead of "download only" (which previously led to Save As on Tauri or a forced download in the browser).<object>pointed at ablob:URL built from decoded attachment bytes; the blob URL is revoked when switching attachments or closing the modal.open_file_with_systemRust command andopenWithSystemViewerbridge helper. Explicit download still uses Save As (save_file_with_dialog) or the browser download control.URL.createObjectURL/revokeObjectURL; unit tests cover MIME/filename PDF detection and Tauri opening the modal for PDFs.AGENTS.mdupdated to match the above.Verification
cargo check(src-tauri): successnpm run lint,npm test,npm run build: successNote:
npm run formatfails in this repo due to an invalid PrettierarrowParensvalue in config (pre-existing).Made with Cursor