Project

General

Profile

Actions

Feature #44362

closed

Preview PDF compatible Adobe Illustrator files

Added by Go MAEDA 27 days ago. Updated 16 days ago.

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

Description

Adobe Illustrator saves .ai files with PDF compatibility by default, so the file is also a valid PDF file. Redmine already creates thumbnails for these files, but it cannot preview them.

Since #43484, Redmine detects the content type from the file contents, and it detects PDF compatible Illustrator files as application/illustrator. Redmine can rely on that content type to show the file in the PDF preview. Illustrator files saved in the older PostScript format are detected as application/postscript, and they are not previewed.

The attached patches:

  • 0001 moves the fallback for an undetermined content type into a new method, Redmine::MimeType.infer_type. AttachmentsController and IconsHelper both had the same code. The patch does not change any behavior, but 0002 depends on it, because attachments uploaded before #43484 may still have application/octet-stream as their content type.
  • 0002 changes Attachment#is_pdf? to look at the content type instead of the file name, and sends PDF compatible files as application/pdf so that browsers display them inline. Marcel treats application/illustrator as a subtype of application/pdf.
  • 0003 adds a dedicated icon for Illustrator files.

Files


Related issues

Related to Redmine - Feature #44400: Make the Download button save PDF files instead of displaying them inline in the browserClosedGo MAEDAActions
Actions #1

Updated by Go MAEDA 24 days ago

  • Target version set to 7.1.0

Setting the target version to 7.1.0.

Actions #2

Updated by Go MAEDA 17 days ago

I have updated the patch.

Changes from the previous patches:

  • Attachment#is_pdf? is left unchanged because plugins may rely on its behavior based on the file name.
  • A new method, Attachment#pdf_previewable?, returns true for PDF files and PDF-compatible Illustrator files. When the content type is blank or application/octet-stream, the check falls back to the file name as before.
  • AttachmentsController#show now uses pdf_previewable? instead of is_pdf? to select the PDF preview.
  • Attachments with an undetermined content type keep the current behavior for both preview and download.
Actions #3

Updated by Go MAEDA 16 days ago

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

Committed the patches in r25028 and r25029.

Actions #4

Updated by Go MAEDA 16 days ago

  • Related to Feature #44400: Make the Download button save PDF files instead of displaying them inline in the browser added
Actions

Also available in: Atom PDF