Feature #44400
openMake the Download button save PDF files instead of displaying them inline in the browser
Description
Currently, the Download button downloads most attachments, but PDF and PDF-compatible files such as Illustrator files are displayed inline in the browser.
This patch makes the Download button always download the file, for two reasons:
- The label does not match the behavior. A button labeled "Download" should download the file regardless of its type. Users cannot predict the result before clicking, and saving a PDF currently requires first opening it in the browser's PDF viewer and then clicking the viewer's download button.
- The inline behavior is no longer necessary. Sending PDFs inline used to be the only way to view a PDF in the browser. However, Redmine 7.0 introduced an attachment preview page for PDFs (#22483), which includes an "Open in full view" link, so PDFs can be viewed there without special handling in the download action.
The change to the Download button does not affect PDF previews. With this patch, the preview page requests the file with an explicit disposition=inline parameter. This parameter is honored only for PDF-compatible files, so other content types such as HTML and SVG cannot be sent inline through this action.
Note: In Firefox, when "Open in Firefox" is configured for PDF files, downloading a PDF also opens the saved file in a new tab. The patch leaves this behavior unchanged because it is controlled by the user's Firefox settings. This could be avoided by sending PDFs as `application/octet-stream`, but I think Redmine should preserve the correct content type, `application/pdf`.
Before:
After:
Files
Related issues
Updated by Go MAEDA 3 days ago
- Related to Feature #22483: Show PDF attachments and repo entries instead of downloading them added
- Related to Feature #44362: Preview PDF compatible Adobe Illustrator files added