mime-types 3.5.0 → 3.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Contributing.md +6 -4
- data/History.md +26 -0
- data/Rakefile +0 -1
- data/lib/mime/type.rb +1 -1
- data/lib/mime/types/logger.rb +1 -1
- data/lib/mime/types.rb +2 -2
- data/test/minitest_helper.rb +0 -1
- data/test/test_mime_type.rb +26 -10
- data/test/test_mime_types.rb +4 -0
- data/test/test_mime_types_class.rb +5 -0
- metadata +5 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfc8b8464d84ae454c33d168638a3c496d4a7c9bcdcc5fb76905a4db3f7f8c68
|
4
|
+
data.tar.gz: 90b122e2a9fb78b41e350f92038854491bf95520cd6764e7719a086da3afa5ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '068f424c28bda754c9870faf925a80525721e7baff71b582ad9b91041510f078c6dc1d1316362347a406dd31c6843c28abd05fdcf7ec211ce35e617817f3741b'
|
7
|
+
data.tar.gz: 7d47eb015acfb84adc666c2ba59eb38da6d349bb029d407725f1046b2ec375a61aee3fcf195bd92f663400a9c9e14ca9d3c53022ad4ba9049b2ef46e662b65ab
|
data/Contributing.md
CHANGED
@@ -82,9 +82,9 @@ Here's the most direct way to get your work merged into the project:
|
|
82
82
|
Thanks to everyone else who has contributed to mime-types over the years:
|
83
83
|
|
84
84
|
- Aaron Patterson
|
85
|
-
- Alex Vondrak
|
86
85
|
- Aggelos Avgerinos
|
87
86
|
- Al Snow
|
87
|
+
- Alex Vondrak
|
88
88
|
- Andre Pankratz
|
89
89
|
- Andy Brody
|
90
90
|
- Arnaud Meuret
|
@@ -93,8 +93,8 @@ Thanks to everyone else who has contributed to mime-types over the years:
|
|
93
93
|
- Chris Gat
|
94
94
|
- David Genord
|
95
95
|
- Dillon Welch
|
96
|
-
- Eric Marden
|
97
96
|
- Edward Betts
|
97
|
+
- Eric Marden
|
98
98
|
- Garret Alfert
|
99
99
|
- Godfrey Chan
|
100
100
|
- Greg Brockman
|
@@ -106,21 +106,23 @@ Thanks to everyone else who has contributed to mime-types over the years:
|
|
106
106
|
- Jeremy Evans
|
107
107
|
- Juanito Fatas
|
108
108
|
- Jun Aruga
|
109
|
-
- Łukasz Śliwa
|
110
109
|
- Keerthi Siva
|
111
110
|
- Ken Ip
|
112
111
|
- Kevin Menard
|
113
112
|
- Koichi ITO
|
113
|
+
- Łukasz Śliwa
|
114
114
|
- Martin d'Allens
|
115
|
+
- Masato Nakamura
|
115
116
|
- Mauricio Linhares
|
116
|
-
- Nicolas Leger
|
117
117
|
- Nicholas La Roux
|
118
|
+
- Nicolas Leger
|
118
119
|
- nycvotes-dev
|
119
120
|
- Olle Jonsson
|
120
121
|
- Postmodern
|
121
122
|
- Richard Hirner
|
122
123
|
- Richard Hurt
|
123
124
|
- Richard Schneeman
|
125
|
+
- Robb Shecter
|
124
126
|
- Tibor Szolár
|
125
127
|
- Todd Carrico
|
126
128
|
|
data/History.md
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 3.5.2 / 2024-01-02
|
4
|
+
|
5
|
+
There are no primary code changes, but we are releasing this as an update as
|
6
|
+
there are some validation changes and updated code with formatting.
|
7
|
+
|
8
|
+
- Dependency and CI updates:
|
9
|
+
|
10
|
+
- Masato Nakamura added Ruby 3.3 to the CI workflow in [#179][].
|
11
|
+
|
12
|
+
- Fixed regressions in standard formatting in [#180][].
|
13
|
+
|
14
|
+
- Removed `minitest-bonus-assertions` because of a bundler resolution issue.
|
15
|
+
Created a better replacement in-line.
|
16
|
+
|
17
|
+
## 3.5.1 / 2023-08-21
|
18
|
+
|
19
|
+
- 1 bug fix:
|
20
|
+
|
21
|
+
- Better handle possible line-termination strings (legal in Unix filenames)
|
22
|
+
such as `\n` in `MIME::Types.type_for`. Reported by ooooooo-q in [#177][],
|
23
|
+
resolved in [#178][].
|
24
|
+
|
3
25
|
## 3.5.0 / 2023-08-07
|
4
26
|
|
5
27
|
- 1 minor enhancement:
|
@@ -304,6 +326,10 @@
|
|
304
326
|
[#166]: https://github.com/mime-types/ruby-mime-types/issues/166
|
305
327
|
[#167]: https://github.com/mime-types/ruby-mime-types/pull/167
|
306
328
|
[#170]: https://github.com/mime-types/ruby-mime-types/pull/170
|
329
|
+
[#177]: https://github.com/mime-types/ruby-mime-types/issues/177
|
330
|
+
[#178]: https://github.com/mime-types/ruby-mime-types/pull/178
|
331
|
+
[#179]: https://github.com/mime-types/ruby-mime-types/pull/179
|
332
|
+
[#180]: https://github.com/mime-types/ruby-mime-types/pull/180
|
307
333
|
[code-of-conduct.md]: Code-of-Conduct_md.html
|
308
334
|
[contributor covenant]: http://contributor-covenant.org
|
309
335
|
[mime-types-data]: https://github.com/mime-types/mime-types-data
|
data/Rakefile
CHANGED
@@ -30,7 +30,6 @@ spec = Hoe.spec "mime-types" do
|
|
30
30
|
extra_dev_deps << ["hoe-rubygems", "~> 1.0"]
|
31
31
|
extra_dev_deps << ["minitest", "~> 5.0"]
|
32
32
|
extra_dev_deps << ["minitest-autotest", "~> 1.0"]
|
33
|
-
extra_dev_deps << ["minitest-bonus-assertions", "~> 3.0"]
|
34
33
|
extra_dev_deps << ["minitest-focus", "~> 1.0"]
|
35
34
|
extra_dev_deps << ["minitest-hooks", "~> 1.4"]
|
36
35
|
extra_dev_deps << ["rake", ">= 10.0", "< 14.0"]
|
data/lib/mime/type.rb
CHANGED
data/lib/mime/types/logger.rb
CHANGED
data/lib/mime/types.rb
CHANGED
@@ -152,7 +152,7 @@ class MIME::Types
|
|
152
152
|
# => [application/xml, image/gif, text/xml]
|
153
153
|
def type_for(filename)
|
154
154
|
Array(filename).flat_map { |fn|
|
155
|
-
@extension_index[fn.chomp.downcase[/\.?([^.]*?)
|
155
|
+
@extension_index[fn.chomp.downcase[/\.?([^.]*?)\z/m, 1]]
|
156
156
|
}.compact.inject(Set.new, :+).sort { |a, b|
|
157
157
|
a.priority_compare(b)
|
158
158
|
}
|
@@ -165,7 +165,7 @@ class MIME::Types
|
|
165
165
|
# The last parameter may be the value <tt>:silent</tt> or +true+ which
|
166
166
|
# will suppress duplicate MIME type warnings.
|
167
167
|
def add(*types)
|
168
|
-
quiet = (
|
168
|
+
quiet = (types.last == :silent) || (types.last == true)
|
169
169
|
|
170
170
|
types.each do |mime_type|
|
171
171
|
case mime_type
|
data/test/minitest_helper.rb
CHANGED
data/test/test_mime_type.rb
CHANGED
@@ -446,37 +446,53 @@ describe MIME::Type do
|
|
446
446
|
describe "#to_h" do
|
447
447
|
let(:t) { mime_type("a/b") }
|
448
448
|
|
449
|
+
def assert_has_keys(wanted_keys, actual, msg = nil)
|
450
|
+
wanted_keys = Array(wanted_keys).uniq.sort
|
451
|
+
actual_keys = if actual.is_a?(Hash)
|
452
|
+
actual.keys
|
453
|
+
else
|
454
|
+
actual.to_h.keys
|
455
|
+
end
|
456
|
+
|
457
|
+
missing = wanted_keys - actual_keys
|
458
|
+
pretty_wanted_keys = (wanted_keys + actual_keys).uniq.sort
|
459
|
+
|
460
|
+
msg = message(msg) {
|
461
|
+
"#{mu_pp(actual)} is missing attribute values\n#{diff(pretty_wanted_keys, actual_keys)}"
|
462
|
+
}
|
463
|
+
|
464
|
+
assert missing.empty?, msg
|
465
|
+
end
|
466
|
+
|
449
467
|
it "has the required keys (content-type, registered, encoding)" do
|
450
|
-
assert_has_keys
|
468
|
+
assert_has_keys %w[content-type registered encoding], t
|
451
469
|
end
|
452
470
|
|
453
471
|
it "has the docs key if there are documents" do
|
454
|
-
assert_has_keys mime_type(t) { |v| v.docs = "a" }
|
472
|
+
assert_has_keys "docs", mime_type(t) { |v| v.docs = "a" }
|
455
473
|
end
|
456
474
|
|
457
475
|
it "has the extensions key if set" do
|
458
|
-
assert_has_keys mime_type(t) { |v| v.extensions = "a" }
|
459
|
-
"extensions"
|
476
|
+
assert_has_keys "extensions", mime_type(t) { |v| v.extensions = "a" }
|
460
477
|
end
|
461
478
|
|
462
479
|
it "has the preferred-extension key if set" do
|
463
|
-
assert_has_keys mime_type(t) { |v| v.preferred_extension = "a" }
|
464
|
-
"preferred-extension"
|
480
|
+
assert_has_keys "preferred-extension", mime_type(t) { |v| v.preferred_extension = "a" }
|
465
481
|
end
|
466
482
|
|
467
483
|
it "has the obsolete key if set" do
|
468
|
-
assert_has_keys mime_type(t) { |v| v.obsolete = true }
|
484
|
+
assert_has_keys "obsolete", mime_type(t) { |v| v.obsolete = true }
|
469
485
|
end
|
470
486
|
|
471
487
|
it "has the obsolete and use-instead keys if set" do
|
472
|
-
assert_has_keys mime_type(t) { |v|
|
488
|
+
assert_has_keys %w[obsolete use-instead], mime_type(t) { |v|
|
473
489
|
v.obsolete = true
|
474
490
|
v.use_instead = "c/d"
|
475
|
-
}
|
491
|
+
}
|
476
492
|
end
|
477
493
|
|
478
494
|
it "has the signature key if set" do
|
479
|
-
assert_has_keys mime_type(t) { |v| v.signature = true }
|
495
|
+
assert_has_keys "signature", mime_type(t) { |v| v.signature = true }
|
480
496
|
end
|
481
497
|
end
|
482
498
|
|
data/test/test_mime_types.rb
CHANGED
@@ -159,6 +159,10 @@ describe MIME::Types do
|
|
159
159
|
plain_text.add_extensions("xtxt")
|
160
160
|
assert_includes mime_types.type_for("xtxt"), "text/plain"
|
161
161
|
end
|
162
|
+
|
163
|
+
it "handles newline characters correctly" do
|
164
|
+
assert_includes mime_types.type_for("test.pdf\n.txt"), "text/plain"
|
165
|
+
end
|
162
166
|
end
|
163
167
|
|
164
168
|
describe "#count" do
|
@@ -100,6 +100,11 @@ describe MIME::Types, "registry" do
|
|
100
100
|
plain_text.add_extensions("xtxt")
|
101
101
|
assert_includes MIME::Types.type_for("xtxt"), "text/plain"
|
102
102
|
end
|
103
|
+
|
104
|
+
it "handles newline characters correctly" do
|
105
|
+
assert_includes MIME::Types.type_for("test.pdf\n.txt"), "text/plain"
|
106
|
+
assert_includes MIME::Types.type_for("test.txt\n.pdf"), "application/pdf"
|
107
|
+
end
|
103
108
|
end
|
104
109
|
|
105
110
|
describe ".count" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mime-types
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Austin Ziegler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mime-types-data
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '5.
|
33
|
+
version: '5.20'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '5.
|
40
|
+
version: '5.20'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: hoe
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,20 +128,6 @@ dependencies:
|
|
128
128
|
- - "~>"
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '1.0'
|
131
|
-
- !ruby/object:Gem::Dependency
|
132
|
-
name: minitest-bonus-assertions
|
133
|
-
requirement: !ruby/object:Gem::Requirement
|
134
|
-
requirements:
|
135
|
-
- - "~>"
|
136
|
-
- !ruby/object:Gem::Version
|
137
|
-
version: '3.0'
|
138
|
-
type: :development
|
139
|
-
prerelease: false
|
140
|
-
version_requirements: !ruby/object:Gem::Requirement
|
141
|
-
requirements:
|
142
|
-
- - "~>"
|
143
|
-
- !ruby/object:Gem::Version
|
144
|
-
version: '3.0'
|
145
131
|
- !ruby/object:Gem::Dependency
|
146
132
|
name: minitest-focus
|
147
133
|
requirement: !ruby/object:Gem::Requirement
|
@@ -321,7 +307,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
321
307
|
- !ruby/object:Gem::Version
|
322
308
|
version: '0'
|
323
309
|
requirements: []
|
324
|
-
rubygems_version: 3.
|
310
|
+
rubygems_version: 3.5.3
|
325
311
|
signing_key:
|
326
312
|
specification_version: 4
|
327
313
|
summary: The mime-types library provides a library and registry for information about
|