Project

General

Profile

Actions

Feature #44400

closed

Make the Download button save PDF files instead of displaying them inline in the browser

Added by Go MAEDA 25 days ago. Updated 12 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Attachments
Target version:
Resolution:
Fixed

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

Related to Redmine - Feature #22483: Show PDF attachments and repo entries instead of downloading themClosedGo MAEDAActions
Related to Redmine - Feature #44362: Preview PDF compatible Adobe Illustrator filesClosedGo MAEDAActions
Actions #1

Updated by Go MAEDA 25 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
Actions #2

Updated by Go MAEDA 19 days ago

  • Target version set to 7.1.0

Setting the target version to 7.1.0.

Actions #3

Updated by Go MAEDA 16 days ago

Here is some historical context on how the Download button has behaved for PDF files.

  • Originally, the Download button always downloaded the file (only images were sent inline).
  • r15409 (#22483, Redmine 3.3.0): PDF files started being sent inline. At the time, this was the only way to view a PDF in the browser without saving it first, so using the download URL for inline viewing was a reasonable compromise.
  • r16285 (#24199, Redmine 3.3.3): images were switched to Content-Disposition: attachment for security reasons. This left PDF as the only file type for which the Download button does not download the file.
  • r24460 (#22483 again, Redmine 7.0.0): the attachment page gained a proper PDF preview with an "Open in full view" link. There is no longer any need for special Download button behavior just to view PDFs in the browser.

In other words, #22483 was ultimately about viewing PDFs in the browser. Sending PDFs inline from the download URL was the best available way to meet that need at the time, and it served users well for many years. Now that Redmine 7.0 provides a dedicated preview page, that behavior has fulfilled its role, and the Download button can return to doing exactly what its label says for every file type.

Actions #4

Updated by Go MAEDA 12 days ago

  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch in r25082.

Actions

Also available in: Atom PDF