Index: Gemfile =================================================================== --- Gemfile (revision 17464) +++ Gemfile (working copy) @@ -7,7 +7,7 @@ gem "rails", "5.2.1" gem "coderay", "~> 1.1.1" gem "request_store", "1.0.5" -gem "mime-types", "~> 3.0" +gem "mini_mime" gem "actionpack-xml_parser" gem "roadie-rails", "~> 1.3.0" gem "roadie", "~> 3.2.1" Index: lib/redmine/mime_type.rb =================================================================== --- lib/redmine/mime_type.rb (revision 17462) +++ lib/redmine/mime_type.rb (working copy) @@ -15,8 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -require 'mime/types' - module Redmine module MimeType @@ -62,15 +60,8 @@ # returns mime type for name or nil if unknown def self.of(name) return nil unless name.present? - if m = name.to_s.match(/(^|\.)([^\.]+)$/) - extension = m[2].downcase - @known_types ||= Hash.new do |h, ext| - type = EXTENSIONS[ext] - type ||= MIME::Types.type_for(ext).first.to_s.presence - h[ext] = type - end - @known_types[extension] - end + ext = File.extname(name)[1..-1].to_s.downcase + EXTENSIONS[ext] || MiniMime.lookup_by_filename(name).try(:content_type) end # Returns the css class associated to