GitLab steht Mittwoch, den 08. Juli, zwischen 09:00 und 13:00 Uhr aufgrund von Wartungsarbeiten nicht zur Verfügung.

Commit 93282b31 authored by maeda's avatar maeda

Replace mime-types gem with more efficient mini_mime gem (#29359).

Contributed by Pavel Rosický.


git-svn-id: https://svn.redmine.org/redmine/trunk@17468 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 814c0970
......@@ -7,7 +7,7 @@ end
gem "rails", "5.2.1"
gem "coderay", "~> 1.1.1"
gem "request_store", "1.0.5"
gem "mime-types", "~> 3.0"
gem "mini_mime", "~> 1.0"
gem "actionpack-xml_parser"
gem "roadie-rails", "~> 1.3.0"
gem "roadie", "~> 3.2.1"
......
......@@ -62,11 +62,11 @@ module Redmine
# 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
extension = File.extname(name)[1..-1].to_s.downcase
if extension.present?
@known_types ||= Hash.new do |h, ext|
type = EXTENSIONS[ext]
type ||= MIME::Types.type_for(ext).first.to_s.presence
type ||= MiniMime.lookup_by_filename("a.#{ext}").try(:content_type)
h[ext] = type
end
@known_types[extension]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment