Actions
Feature #44362
closedPreview PDF compatible Adobe Illustrator files
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 asapplication/pdfso that browsers display them inline. Marcel treatsapplication/illustratoras a subtype ofapplication/pdf. - 0003 adds a dedicated icon for Illustrator files.
Files
Related issues
Updated by Go MAEDA 17 days ago
- File 0001-Preview-Adobe-Illustrator-files-saved-in-the-PDF-com.patch 0001-Preview-Adobe-Illustrator-files-saved-in-the-PDF-com.patch added
- File 0002-Show-a-dedicated-icon-for-Adobe-Illustrator-files.patch 0002-Show-a-dedicated-icon-for-Adobe-Illustrator-files.patch added
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 orapplication/octet-stream, the check falls back to the file name as before. AttachmentsController#shownow usespdf_previewable?instead ofis_pdf?to select the PDF preview.- Attachments with an undetermined content type keep the current behavior for both preview and download.
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