Patch #29359 » 29359-remove-known-types-hash.patch
Gemfile | ||
---|---|---|
7 | 7 |
gem "rails", "5.2.1" |
8 | 8 |
gem "coderay", "~> 1.1.1" |
9 | 9 |
gem "request_store", "1.0.5" |
10 |
gem "mini_mime", "~> 1.0" |
|
10 |
gem "mini_mime", "~> 1.0.1"
|
|
11 | 11 |
gem "actionpack-xml_parser" |
12 | 12 |
gem "roadie-rails", "~> 1.3.0" |
13 | 13 |
gem "roadie", "~> 3.2.1" |
lib/redmine/mime_type.rb | ||
---|---|---|
62 | 62 |
# returns mime type for name or nil if unknown |
63 | 63 |
def self.of(name) |
64 | 64 |
return nil unless name.present? |
65 |
extension = File.extname(name)[1..-1].to_s.downcase |
|
66 |
if extension.present? |
|
67 |
@known_types ||= Hash.new do |h, ext| |
|
68 |
type = EXTENSIONS[ext] |
|
69 |
type ||= MiniMime.lookup_by_filename("a.#{ext}").try(:content_type) |
|
70 |
h[ext] = type |
|
71 |
end |
|
72 |
@known_types[extension] |
|
65 |
ext = File.extname(name)[1..-1] |
|
66 |
if ext |
|
67 |
type = |
|
68 |
EXTENSIONS[ext] || |
|
69 |
((mi = MiniMime.lookup_by_extension(ext)) && mi.content_type) |
|
73 | 70 |
end |
74 | 71 |
end |
75 | 72 |