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 4 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.
Greptile SummaryThis PR fixes PDF downloads so the browser uses the Trilium note title as the default filename instead of a generic name. It replaces the old
Confidence Score: 5/5The change is safe to merge — it replaces a broken iframe postMessage path with the already-tested open.ts helpers used consistently across all other file download flows. The fix is narrow and surgical: three lines in one file replace the old postMessage approach with open.getUrlForDownload() and open.download(), which are already used for every other file type in the codebase. No files require special attention. Important Files Changed
|
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
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)