mime-types 2.4.1 → 2.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/Contributing.rdoc +2 -0
- data/History-Types.rdoc +6 -1
- data/History.rdoc +15 -1
- data/README.rdoc +6 -2
- data/Rakefile +18 -0
- data/lib/mime/type.rb +22 -11
- data/lib/mime/types/loader.rb +16 -16
- data/support/convert.rb +0 -2
- data/support/iana_registry.rb +60 -56
- data/test/test_mime_type.rb +15 -14
- data/test/test_mime_types.rb +2 -1
- data/test/test_mime_types_class.rb +1 -1
- data/test/test_mime_types_loader.rb +1 -1
- metadata +7 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MWViMWFhNWYxYmU3ZjM1NmE4ODUwNzM4ZjFlNDU1NjY0MTJhODBjMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YmNmY2UyMDhkYjk0ZmE2NTE0MjI2ZWMxNjJmYzY4YjgwZTRkY2E5ZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTExNDY1MzFlNmFhMDU5NWQxMTEzZTY2YzE2ZWNlMjkzY2VmNzZmZjI3NGQ4
|
10
|
+
YmRmNjQ3NzY0YzA0ODhmNzEzZTc2N2E4NDg5NWI2NjczNjQ0Nzg3NDY4Njkz
|
11
|
+
OTlhNGVkNzBlYzcyZGU0MWVjNTk0NjMzNjhiOGRhZGI3YWZiY2I=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YTZiMDRlYzljMDk4MDRjZTA0MGJhMWFhMTU1YWIyNTQ1MDc4YTkzOTVkYjg4
|
14
|
+
MGVhYTZlODU2MDEzOTBiOTc0ZTIxYzhiMmQ1MDhjNGUwNWQ5ZTA0NDY1YThj
|
15
|
+
MWYzYTBiNTk4NDQzMzFjNjk3MzMwM2Q0MTUwNzVkM2YyNDY5Yjk=
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/Contributing.rdoc
CHANGED
data/History-Types.rdoc
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
= MIME Types Changes by Version
|
2
2
|
|
3
|
-
== 2.4 / 2014-10-
|
3
|
+
== 2.4.2 / 2014-10-15
|
4
|
+
* Added application/vnd.ms-outlook as an unregistered MIME type with the
|
5
|
+
extension +msg+. Provided by @keerthisiv in
|
6
|
+
{#72}[https://github.com/halostatue/mime-types/pull/72].
|
7
|
+
|
8
|
+
== 2.4.1 / 2014-10-07
|
4
9
|
|
5
10
|
* Changed the sort order of many of the extensions to restore behaviour
|
6
11
|
from mime-types 1.25.1.
|
data/History.rdoc
CHANGED
@@ -1,4 +1,18 @@
|
|
1
|
-
== 2.4 / 2014-10-
|
1
|
+
== 2.4.2 / 2014-10-15
|
2
|
+
|
3
|
+
* Bugs:
|
4
|
+
* Aaron Patterson (@tenderlove) found a loading bug and provided a fix that
|
5
|
+
nearly doubled registry load performance
|
6
|
+
({#74}[https://github.com/halostatue/mime-types/pull/74]).
|
7
|
+
* Godfrey Chan (@chancancode) provided a prophylactic security fix to use
|
8
|
+
<tt>JSON.parse</tt> instead of <tt>JSON.load</tt> in
|
9
|
+
{#75}[https://github.com/halostatue/mime-types/pull/75]. This provides a
|
10
|
+
20% improvement over the already improved result, resulting in a total 55%
|
11
|
+
performance boost.
|
12
|
+
|
13
|
+
== 2.4.1 / 2014-10-07
|
14
|
+
|
15
|
+
mime-types 2.4 was pulled.
|
2
16
|
|
3
17
|
* Bugs:
|
4
18
|
* Restored the extension sort order from mime-types 1.25.1 and modified
|
data/README.rdoc
CHANGED
@@ -24,8 +24,12 @@ add additional type definitions (see Contributing.rdoc). The primary sources
|
|
24
24
|
for MIME type definitions found in mime-types is the IANA collection of
|
25
25
|
registrations (see below for the link), RFCs, and W3C recommendations.
|
26
26
|
|
27
|
-
This is release 2.4.
|
28
|
-
|
27
|
+
This is release 2.4.2, fixing bugs with unnecessary object duplication and
|
28
|
+
using JSON.parse instead of JSON.load. These fixes improve the JSON registry
|
29
|
+
loading time by about 55% over previous 2.x releases. Cached registry load
|
30
|
+
times are not changed. This release builds on the 2.4.1 release, which fixed a
|
31
|
+
bug in observed use of the mime-types library where extensions were not
|
32
|
+
previously sorted, such that
|
29
33
|
|
30
34
|
MIME::Types.of('image.jpg').first.extensions.first
|
31
35
|
|
data/Rakefile
CHANGED
@@ -109,6 +109,24 @@ namespace :mime do
|
|
109
109
|
end
|
110
110
|
|
111
111
|
namespace :convert do
|
112
|
+
namespace :docs do
|
113
|
+
task :setup do
|
114
|
+
gem 'rdoc'
|
115
|
+
require 'rdoc/rdoc'
|
116
|
+
@doc_converter ||= RDoc::Markup::ToMarkdown.new
|
117
|
+
end
|
118
|
+
|
119
|
+
%w(README History History-Types).each do |name|
|
120
|
+
file "#{name}.md" => [ "#{name}.rdoc", :setup ] do |t|
|
121
|
+
File.open(t.name, 'wb') { |target|
|
122
|
+
target.write @doc_converter.convert(IO.read(t.prerequisites.first))
|
123
|
+
}
|
124
|
+
end
|
125
|
+
|
126
|
+
task docs: [ name ]
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
112
130
|
namespace :yaml do
|
113
131
|
desc "Convert from YAML to JSON"
|
114
132
|
task :json, [ :source, :destination, :multiple_files ] => :support do |t, args|
|
data/lib/mime/type.rb
CHANGED
@@ -50,18 +50,16 @@ class MIME::Type
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def to_s
|
53
|
-
"Invalid Encoding #{@encoding.inspect} (valid values
|
54
|
-
"#{MIME::Type::VALID_ENCODINGS.inspect})."
|
53
|
+
"Invalid Encoding #{@encoding.inspect} (valid values: #{VALID_ENCODINGS.inspect})."
|
55
54
|
end
|
56
55
|
# :startdoc:
|
57
56
|
end
|
58
57
|
|
59
58
|
# The released version of the mime-types library.
|
60
|
-
VERSION = '2.4.
|
59
|
+
VERSION = '2.4.2'
|
61
60
|
|
62
61
|
include Comparable
|
63
62
|
|
64
|
-
# :stopdoc:
|
65
63
|
MEDIA_TYPE_RE = %r{([-\w.+]+)/([-\w.+]*)}o
|
66
64
|
UNREGISTERED_RE = %r{[Xx]-}o
|
67
65
|
I18N_RE = %r{[^[:alnum:]]}o
|
@@ -76,7 +74,9 @@ class MIME::Type
|
|
76
74
|
RFC_URL = "http://rfc-editor.org/rfc/rfc%s.txt"
|
77
75
|
DRAFT_URL = "http://datatracker.ietf.org/public/idindex.cgi?command=id_details&filename=%s"
|
78
76
|
CONTACT_URL = "http://www.iana.org/assignments/contact-people.htm#%s"
|
79
|
-
|
77
|
+
private_constant :MEDIA_TYPE_RE, :UNREGISTERED_RE, :I18N_RE, :PLATFORM_RE,
|
78
|
+
:DEFAULT_ENCODINGS, :BINARY_ENCODINGS, :TEXT_ENCODINGS, :VALID_ENCODINGS,
|
79
|
+
:IANA_URL, :RFC_URL, :DRAFT_URL, :CONTACT_URL
|
80
80
|
|
81
81
|
# Builds a MIME::Type object from the provided MIME Content Type value
|
82
82
|
# (e.g., 'text/plain' or 'applicaton/x-eruby'). The constructed object is
|
@@ -157,13 +157,13 @@ class MIME::Type
|
|
157
157
|
def priority_compare(other)
|
158
158
|
pc = simplified <=> other.simplified
|
159
159
|
if pc.zero?
|
160
|
-
pc = if (
|
160
|
+
pc = if (reg = registered?) != other.registered?
|
161
161
|
reg ? -1 : 1 # registered < unregistered
|
162
|
-
elsif (
|
162
|
+
elsif (plat = platform?(true)) != other.platform?(true)
|
163
163
|
plat ? 1 : -1 # generic < platform
|
164
|
-
elsif (
|
164
|
+
elsif (comp = complete?) != other.complete?
|
165
165
|
comp ? -1 : 1 # complete < incomplete
|
166
|
-
elsif (
|
166
|
+
elsif (obs = obsolete?) != other.obsolete?
|
167
167
|
obs ? 1 : -1 # current < obsolete
|
168
168
|
elsif obs and ((ui = use_instead) != (oui = other.use_instead))
|
169
169
|
if ui.nil?
|
@@ -275,6 +275,7 @@ class MIME::Type
|
|
275
275
|
MIME.deprecated(self, __method__)
|
276
276
|
@system
|
277
277
|
end
|
278
|
+
|
278
279
|
def system=(os) # :nodoc:
|
279
280
|
if os.nil? or os.kind_of?(Regexp)
|
280
281
|
@system = os
|
@@ -302,6 +303,7 @@ class MIME::Type
|
|
302
303
|
def obsolete?
|
303
304
|
!!@obsolete
|
304
305
|
end
|
306
|
+
|
305
307
|
def obsolete=(v) # :nodoc:
|
306
308
|
@obsolete = !!v
|
307
309
|
end
|
@@ -324,6 +326,8 @@ class MIME::Type
|
|
324
326
|
@friendly.merge!(Hash[*lang])
|
325
327
|
when Hash
|
326
328
|
@friendly.merge!(lang)
|
329
|
+
else
|
330
|
+
raise ArgumentError
|
327
331
|
end
|
328
332
|
end
|
329
333
|
|
@@ -352,6 +356,7 @@ class MIME::Type
|
|
352
356
|
MIME.deprecated(self, __method__, "and has been renamed to #references")
|
353
357
|
references
|
354
358
|
end
|
359
|
+
|
355
360
|
def url=(r) # :nodoc:
|
356
361
|
MIME.deprecated(self, __method__)
|
357
362
|
self.references = r
|
@@ -425,7 +430,7 @@ class MIME::Type
|
|
425
430
|
values.map { |data|
|
426
431
|
"http://www.iana.org/assignments/media-types/#{data}"
|
427
432
|
}
|
428
|
-
|
433
|
+
else # 'uri', 'text', etc.
|
429
434
|
values
|
430
435
|
end
|
431
436
|
}.flatten
|
@@ -449,6 +454,7 @@ class MIME::Type
|
|
449
454
|
!!@registered
|
450
455
|
end
|
451
456
|
end
|
457
|
+
|
452
458
|
def registered=(v) # :nodoc:
|
453
459
|
@registered = v.nil? ? v : !!v
|
454
460
|
end
|
@@ -472,6 +478,7 @@ class MIME::Type
|
|
472
478
|
def signature?
|
473
479
|
!!@signature
|
474
480
|
end
|
481
|
+
|
475
482
|
def signature=(v) # :nodoc:
|
476
483
|
@signature = !!v
|
477
484
|
end
|
@@ -550,7 +557,9 @@ class MIME::Type
|
|
550
557
|
encode_with({})
|
551
558
|
end
|
552
559
|
|
553
|
-
#
|
560
|
+
# Populates the +coder+ with attributes about this record for
|
561
|
+
# serialization. The structure of +coder+ should match the structure used
|
562
|
+
# with #init_with.
|
554
563
|
def encode_with(coder)
|
555
564
|
coder['content-type'] = @content_type
|
556
565
|
coder['docs'] = @docs unless @docs.nil? or @docs.empty?
|
@@ -569,6 +578,8 @@ class MIME::Type
|
|
569
578
|
coder
|
570
579
|
end
|
571
580
|
|
581
|
+
# Initialize an empty object from +coder+, which must contain the
|
582
|
+
# attributes necessary for initializing an empty object.
|
572
583
|
def init_with(coder)
|
573
584
|
self.content_type = coder['content-type']
|
574
585
|
self.docs = coder['docs'] || []
|
data/lib/mime/types/loader.rb
CHANGED
@@ -56,9 +56,7 @@ class MIME::Types::Loader
|
|
56
56
|
# This method is aliased to #load.
|
57
57
|
def load_json
|
58
58
|
Dir[json_path].sort.each do |f|
|
59
|
-
types = self.class.load_from_json(f)
|
60
|
-
MIME::Type.new(type)
|
61
|
-
}
|
59
|
+
types = self.class.load_from_json(f)
|
62
60
|
container.add(*types, :silent)
|
63
61
|
end
|
64
62
|
container
|
@@ -79,6 +77,7 @@ class MIME::Types::Loader
|
|
79
77
|
container
|
80
78
|
end
|
81
79
|
|
80
|
+
# Raised when a V1 format file is discovered.
|
82
81
|
BadV1Format = Class.new(Exception)
|
83
82
|
|
84
83
|
class << self
|
@@ -131,7 +130,7 @@ class MIME::Types::Loader
|
|
131
130
|
item = line.chomp.strip
|
132
131
|
next if item.empty?
|
133
132
|
|
134
|
-
m =
|
133
|
+
m = V1_FORMAT.match(item)
|
135
134
|
|
136
135
|
unless m
|
137
136
|
warn <<-EOS
|
@@ -142,7 +141,7 @@ class MIME::Types::Loader
|
|
142
141
|
end
|
143
142
|
|
144
143
|
unregistered, obsolete, platform, mediatype, subtype, extensions,
|
145
|
-
encoding, urls, docs,
|
144
|
+
encoding, urls, docs, _ = *m.captures
|
146
145
|
|
147
146
|
next if mediatype.nil?
|
148
147
|
|
@@ -198,7 +197,7 @@ class MIME::Types::Loader
|
|
198
197
|
# shipped with the mime-types library.
|
199
198
|
def load_from_json(filename)
|
200
199
|
require 'json'
|
201
|
-
JSON.
|
200
|
+
JSON.parse(read_file(filename)).map { |type| MIME::Type.new(type) }
|
202
201
|
end
|
203
202
|
|
204
203
|
private
|
@@ -222,18 +221,19 @@ class MIME::Types::Loader
|
|
222
221
|
|
223
222
|
# The regular expression used to match a v1-format file-based MIME type
|
224
223
|
# definition.
|
225
|
-
|
224
|
+
V1_FORMAT = # :nodoc:
|
226
225
|
%r{\A\s*
|
227
|
-
([*])?
|
228
|
-
(!)?
|
229
|
-
(?:(\w+):)?
|
230
|
-
#
|
231
|
-
(?:\s+@(\S+))?
|
232
|
-
(?:\s+:(base64|7bit|8bit|quoted\-printable))?
|
233
|
-
(?:\s+'(\S+))?
|
234
|
-
(?:\s+=(.+))?
|
235
|
-
(?:\s*([#].*)?)?
|
226
|
+
([*])? # 0: Unregistered?
|
227
|
+
(!)? # 1: Obsolete?
|
228
|
+
(?:(\w+):)? # 2: Platform marker
|
229
|
+
([-\w.+]+)/([-\w.+]*) # 3, 4: Media Type
|
230
|
+
(?:\s+@(\S+))? # 5: Extensions
|
231
|
+
(?:\s+:(base64|7bit|8bit|quoted\-printable))? # 6: Encoding
|
232
|
+
(?:\s+'(\S+))? # 7: URL list
|
233
|
+
(?:\s+=(.+))? # 8: Documentation
|
234
|
+
(?:\s*([#].*)?)? # Comments
|
236
235
|
\s*
|
237
236
|
\z
|
238
237
|
}x
|
238
|
+
private_constant :V1_FORMAT
|
239
239
|
end
|
data/support/convert.rb
CHANGED
data/support/iana_registry.rb
CHANGED
@@ -52,62 +52,8 @@ class IANARegistry
|
|
52
52
|
|
53
53
|
def parse
|
54
54
|
@registry.css('record').each do |record|
|
55
|
-
subtype
|
56
|
-
refs
|
57
|
-
case xref["type"]
|
58
|
-
when 'person'
|
59
|
-
"[#{xref["data"]}]"
|
60
|
-
when 'rfc'
|
61
|
-
xref["data"].upcase
|
62
|
-
when 'draft'
|
63
|
-
"DRAFT:#{xref["data"].sub(/^RFC-/, 'draft-')}"
|
64
|
-
when 'rfc-errata'
|
65
|
-
"{RFC Errata #{xref["data"]}=http://www.rfc-editor.org/errata_search.php?eid=#{xref["data"]}}"
|
66
|
-
when 'uri'
|
67
|
-
# Fix a couple of known-broken links:
|
68
|
-
case xref["data"]
|
69
|
-
when /contact-people.htmll#Dolan\z/
|
70
|
-
"[Dolan]"
|
71
|
-
when /contact-people.htmll#Rottmann?\z/
|
72
|
-
"[Frank_Rottman]"
|
73
|
-
else
|
74
|
-
"{#{xref["data"]}}"
|
75
|
-
end
|
76
|
-
when 'text'
|
77
|
-
xref["data"]
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
xrefs = MIME::Types::Container.new
|
82
|
-
record.css('xref').map do |xref|
|
83
|
-
type, data = xref["type"], xref["data"]
|
84
|
-
|
85
|
-
case type
|
86
|
-
when 'uri'
|
87
|
-
case data
|
88
|
-
when /contact-people.htmll#Dolan\z/
|
89
|
-
type, data = "person", "Dolan"
|
90
|
-
when /contact-people.htmll#Rottmann?\z/
|
91
|
-
type, data = "person", "Frank_Rottman"
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
xrefs[type] << data
|
96
|
-
end
|
97
|
-
|
98
|
-
record.css('file').each do |file|
|
99
|
-
file_name = if file.text == subtype
|
100
|
-
[ @type, subtype ].join('/')
|
101
|
-
else
|
102
|
-
file.text
|
103
|
-
end
|
104
|
-
|
105
|
-
if file["type"] == "template"
|
106
|
-
refs << (ASSIGNMENT_FILE_REF % [ file_name, file_name ])
|
107
|
-
end
|
108
|
-
|
109
|
-
xrefs[file["type"]] << file_name
|
110
|
-
end
|
55
|
+
subtype = record.at_css('name').text
|
56
|
+
refs, xrefs = parse_refs_and_files(record.css('xref'), record.css('file'))
|
111
57
|
|
112
58
|
content_type = [ @type, subtype ].join('/')
|
113
59
|
obsolete = record.at_css('obsolete')
|
@@ -151,4 +97,62 @@ class IANARegistry
|
|
151
97
|
MIME::Types.new
|
152
98
|
end
|
153
99
|
end
|
100
|
+
|
101
|
+
def parse_refs_and_files(refs, files)
|
102
|
+
xr = MIME::Types::Container.new
|
103
|
+
r = []
|
104
|
+
|
105
|
+
refs.each do |xref|
|
106
|
+
type, data = xref["type"], xref["data"]
|
107
|
+
|
108
|
+
# Fix some known-broken links that are actually people.
|
109
|
+
if type == 'uri'
|
110
|
+
case data
|
111
|
+
when /contact-people.htmll#Dolan\z/
|
112
|
+
type, data = "person", "Dolan"
|
113
|
+
when /contact-people.htmll#Rottmann?\z/
|
114
|
+
type, data = "person", "Frank_Rottman"
|
115
|
+
else
|
116
|
+
nil # There’s no error with this URI.
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
r << xref_to_ref(type, data)
|
121
|
+
|
122
|
+
xrefs[type] << data
|
123
|
+
end
|
124
|
+
|
125
|
+
files.each do |file|
|
126
|
+
file_name = if file.text == subtype
|
127
|
+
[ @type, subtype ].join('/')
|
128
|
+
else
|
129
|
+
file.text
|
130
|
+
end
|
131
|
+
|
132
|
+
if file["type"] == "template"
|
133
|
+
refs << (ASSIGNMENT_FILE_REF % [ file_name, file_name ])
|
134
|
+
end
|
135
|
+
|
136
|
+
xrefs[file["type"]] << file_name
|
137
|
+
end
|
138
|
+
|
139
|
+
r, xr
|
140
|
+
end
|
141
|
+
|
142
|
+
def ref_from_type(type, data)
|
143
|
+
case type
|
144
|
+
when 'person'
|
145
|
+
"[#{data}]"
|
146
|
+
when 'rfc'
|
147
|
+
data.upcase
|
148
|
+
when 'draft'
|
149
|
+
"DRAFT:#{data.sub(/^RFC-/, 'draft-')}"
|
150
|
+
when 'rfc-errata'
|
151
|
+
"{RFC Errata #{data}=http://www.rfc-editor.org/errata_search.php?eid=#{data}}"
|
152
|
+
when 'uri'
|
153
|
+
"{#{data}}"
|
154
|
+
else # 'text' or something else
|
155
|
+
data
|
156
|
+
end
|
157
|
+
end
|
154
158
|
end
|
data/test/test_mime_type.rb
CHANGED
@@ -101,7 +101,7 @@ class TestMIMEType < Minitest::Test
|
|
101
101
|
assert_nil(MIME::Type.i18n_key('text'))
|
102
102
|
end
|
103
103
|
|
104
|
-
def
|
104
|
+
def test_spaceship_compare # '<=>'
|
105
105
|
assert(MIME::Type.new('text/plain') == MIME::Type.new('text/plain'))
|
106
106
|
assert(MIME::Type.new('text/plain') != MIME::Type.new('image/jpeg'))
|
107
107
|
assert(MIME::Type.new('text/plain') == 'text/plain')
|
@@ -167,11 +167,9 @@ class TestMIMEType < Minitest::Test
|
|
167
167
|
assert_equal('base64', yaml.encoding)
|
168
168
|
yaml.encoding = :default
|
169
169
|
assert_equal('quoted-printable', yaml.encoding)
|
170
|
-
|
170
|
+
assert_raises(MIME::Type::InvalidEncoding) {
|
171
171
|
yaml.encoding = 'binary'
|
172
|
-
|
173
|
-
assert_equal('Invalid Encoding "binary" (valid values are [nil, :default, "base64", "8bit", "7bit", "quoted-printable"]).', ex.message)
|
174
|
-
end
|
172
|
+
}
|
175
173
|
end
|
176
174
|
|
177
175
|
def test_default_encoding
|
@@ -417,15 +415,18 @@ class TestMIMEType < Minitest::Test
|
|
417
415
|
def test_to_hash
|
418
416
|
yaml = make_yaml_mime_type
|
419
417
|
assert_deprecated("MIME::Type#to_hash") do
|
420
|
-
assert_equal(
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
418
|
+
assert_equal(
|
419
|
+
{
|
420
|
+
'Content-Type' => 'text/x-yaml',
|
421
|
+
'Content-Transfer-Encoding' => '8bit',
|
422
|
+
'Extensions' => %w(yaml yml),
|
423
|
+
'System' => /d9d172f608/,
|
424
|
+
'Registered' => false,
|
425
|
+
'URL' => [],
|
426
|
+
'Obsolete' => false,
|
427
|
+
'Docs' => nil
|
428
|
+
},
|
429
|
+
yaml.to_hash)
|
429
430
|
end
|
430
431
|
end
|
431
432
|
|
data/test/test_mime_types.rb
CHANGED
@@ -15,7 +15,7 @@ class TestMIMETypes < Minitest::Test
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def test_enumerable
|
18
|
-
assert(@mime_types.any? {|type| type.content_type == 'text/plain'})
|
18
|
+
assert(@mime_types.any? { |type| type.content_type == 'text/plain' })
|
19
19
|
assert_kind_of(Enumerator, @mime_types.each)
|
20
20
|
assert_equal(6, @mime_types.each.count)
|
21
21
|
end
|
@@ -56,6 +56,7 @@ class TestMIMETypes < Minitest::Test
|
|
56
56
|
assert_empty(MIME::Types['text/plain', platform: true])
|
57
57
|
end
|
58
58
|
end
|
59
|
+
|
59
60
|
def test_add
|
60
61
|
eruby = MIME::Type.new("application/x-eruby") do |t|
|
61
62
|
t.extensions = "rhtml"
|
@@ -9,7 +9,7 @@ class TestMIMETypesQueryClassMethods < Minitest::Test
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def test_enumerable
|
12
|
-
assert(MIME::Types.any? {|type| type.content_type == 'text/plain'})
|
12
|
+
assert(MIME::Types.any? { |type| type.content_type == 'text/plain' })
|
13
13
|
assert_kind_of(Enumerator, MIME::Types.each)
|
14
14
|
assert(MIME::Types.each.count > 999)
|
15
15
|
end
|
@@ -18,7 +18,7 @@ class TestMIMETypesLoader < Minitest::Test
|
|
18
18
|
assert_equal(%w(webm), types['audio/webm'].first.extensions)
|
19
19
|
refute(types['audio/webm'].first.registered?)
|
20
20
|
|
21
|
-
assert_equal(
|
21
|
+
assert_equal('Fixes a bug with IE6 and progressive JPEGs',
|
22
22
|
types['image/pjpeg'].first.docs)
|
23
23
|
|
24
24
|
assert(types['application/x-apple-diskimage'].first.system?)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mime-types
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Austin Ziegler
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
SHkzay9FVEZoaSs3cElVV2xGbzBpbXJkeUxoZCtKdzNib1ZqM0NtdnloY3dt
|
37
37
|
cG9NMEs5bApBT21yVWlFbFVxTE9aQT09Ci0tLS0tRU5EIENFUlRJRklDQVRF
|
38
38
|
LS0tLS0K
|
39
|
-
date: 2014-10-
|
39
|
+
date: 2014-10-15 00:00:00.000000000 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
@@ -203,8 +203,11 @@ description: ! "The mime-types library provides a library and registry for infor
|
|
203
203
|
incomplete; don't hesitate to to\nadd additional type definitions (see Contributing.rdoc).
|
204
204
|
The primary sources\nfor MIME type definitions found in mime-types is the IANA collection
|
205
205
|
of\nregistrations (see below for the link), RFCs, and W3C recommendations.\n\nThis
|
206
|
-
is release 2.4.
|
207
|
-
|
206
|
+
is release 2.4.2, fixing bugs with unnecessary object duplication and\nusing JSON.parse
|
207
|
+
instead of JSON.load. These fixes improve the JSON registry\nloading time by about
|
208
|
+
55% over previous 2.x releases. Cached registry load\ntimes are not changed. This
|
209
|
+
release builds on the 2.4.1 release, which fixed a\nbug in observed use of the mime-types
|
210
|
+
library where extensions were not\npreviously sorted, such that\n\n MIME::Types.of('image.jpg').first.extensions.first\n\nreturned
|
208
211
|
a value of +jpeg+ in mime-types 1, but +jpe+ in mime-types 2. This was\nintroduced
|
209
212
|
because extensions were sorted during assignment\n(MIME::Type#extensions=). This
|
210
213
|
behaviour has been reverted to protect clients\nthat work as noted above. The preferred
|
metadata.gz.sig
CHANGED
Binary file
|