Project

General

Profile

Actions

Feature #44385

closed

Replace MiniMime with Marcel in Redmine::MimeType for consistent MIME type lookup

Added by Go MAEDA 22 days ago. Updated 21 days ago.

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

Description

Redmine currently uses two MIME type databases:

  • MiniMime, used by Redmine::MimeType to look up a type from a file extension.
  • Marcel, used by Attachment and Redmine::Thumbnail to detect a type from file contents.

Because the two databases can map the same extension to different MIME types, the result can depend on which code path is used. For example, MiniMime maps .ai to application/pdf, while Marcel maps it to application/illustrator. This inconsistency had to be worked around in #44335 by hardcoding application/illustrator into Redmine::MimeType::MIME_TYPES.

This patch switches Redmine::MimeType from MiniMime to Marcel, so Marcel is used consistently throughout the application.

Benefits:

  • The same MIME type database is used throughout Redmine, so the same extension consistently resolves to the same MIME type.
  • The workaround added in #44335 is no longer needed and is removed.
  • `mini_mime` is no longer a direct dependency and is removed from the Gemfile.

Files


Related issues

Related to Redmine - Defect #44335: PDF preview of .ai attachments triggers an automatic downloadClosedGo MAEDAActions
Related to Redmine - Feature #43484: Detect attachment content type from file contents instead of trusting client-provided valuesClosedGo MAEDAActions
Actions

Also available in: Atom PDF