fix(pdf): a pdf now dont forget its name when it gets downloadet #10048
fix(pdf): a pdf now dont forget its name when it gets downloadet #10048Excubitorum wants to merge 6 commits into
Conversation
Replace the postMessage-based download (trilium-request-download) with a direct call to /api/notes/:id/download, which sets Content-Disposition with the note title. Adds Electron support and fixes read-only notes where the iframe handler was never registered. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request updates the PDF preview widget to handle custom downloads directly. Instead of posting a message to an iframe, it now triggers a download using window.electronApi.shell.downloadURL in Electron environments, or by updating window.location.href in web environments. A review comment correctly identifies that the constructed URL may be relative, which will cause the Electron download API to fail, and suggests resolving this by converting the URL to an absolute path using the new URL constructor.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Use getUrlForDownload() and download() from open.ts instead of inline logic to ensure the correct absolute URL is passed to the Electron downloader. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…torum/Trilium-pdf into fix/pdf-download-filename
Flush any pending in-viewer annotation edits via spacedUpdate before the server download, so the file reflects the latest state and not just the last debounced auto-save. Also remove the now-unused manageDownload() iframe handler and its registration: nothing posts trilium-request-download anymore since the download is triggered at the component level. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Bundle ReportChanges will increase total bundle size by 2.55MB (2.63%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: client-esmAssets Changed:
Files in
|
Thanks for your work this Project looks really promissing and nice
trilium-request-downloadpostMessage with a direct call to/api/notes/:id/downloadContent-Disposition: attachment; filename="<note title>.pdf"viaBNote.getFileName(), so the browser uses the Trilium note title as the default download filenameelectronApi.shell.downloadURL()manageDownload) was never registered (it only runs wheneditable=1)Test plan
#readOnlylabel required)