mime-types 3.4.1 → 3.5.0
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/.standard.yml +4 -0
- data/Contributing.md +10 -11
- data/History.md +63 -23
- data/Manifest.txt +1 -0
- data/README.rdoc +1 -1
- data/Rakefile +13 -53
- data/lib/mime/type.rb +28 -2
- data/lib/mime/types/cache.rb +3 -7
- data/lib/mime/types/deprecations.rb +12 -12
- data/lib/mime/types/registry.rb +1 -1
- data/lib/mime/types.rb +7 -7
- data/test/test_mime_type.rb +21 -1
- data/test/test_mime_types_cache.rb +1 -1
- metadata +40 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcfb18b8a1063e841659b369decec0047b8b540769b271c665f02e5f77e8fc8e
|
4
|
+
data.tar.gz: 73a977e080d43c997ceb7c62df0a91fa30bc51b4c8cc14e50e23b4895488cd59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc2c9dddfff6a9b6b74aa4997ac2c3bd3287f51231ec48c3c5cdfdbc140488aaed43348b2a3b8460d2d50e7fffb425f6bc1f3887b5cf25571b8047573ee15bfe
|
7
|
+
data.tar.gz: 6fbcfac5acae5ce40781a705c2d48b650077126f4f847c14dc7c24797cd98ff9a4b886963f90ff26ed16f63533e7ea36fbc084790a1e7b2e6ba5d2004db268b2
|
data/.standard.yml
ADDED
data/Contributing.md
CHANGED
@@ -6,11 +6,11 @@ request, or code contributions.
|
|
6
6
|
There are a few guidelines for contributing to mime-types:
|
7
7
|
|
8
8
|
- Code changes _will_ _not_ be accepted without tests. The test suite is
|
9
|
-
written with [minitest].
|
9
|
+
written with [minitest][].
|
10
10
|
- Match my coding style.
|
11
11
|
- Use a thoughtfully-named topic branch that contains your change. Rebase your
|
12
12
|
commits into logical chunks as necessary.
|
13
|
-
- Use [quality commit messages].
|
13
|
+
- Use [quality commit messages][].
|
14
14
|
- Do not change the version number; when your patch is accepted and a release
|
15
15
|
is made, the version will be updated at that point.
|
16
16
|
- Submit a GitHub pull request with your changes.
|
@@ -19,25 +19,23 @@ There are a few guidelines for contributing to mime-types:
|
|
19
19
|
## Adding or Modifying MIME Types
|
20
20
|
|
21
21
|
The mime-types registry is no longer contained in mime-types, but in
|
22
|
-
[mime-types-data]. Please see that project for contributions there.
|
22
|
+
[mime-types-data][]. Please see that project for contributions there.
|
23
23
|
|
24
24
|
### Test Dependencies
|
25
25
|
|
26
|
-
mime-types uses Ryan Davis’s [Hoe] to manage the release process, and it adds
|
27
|
-
a number of rake tasks. You will mostly be interested in `rake`, which runs
|
28
|
-
|
26
|
+
mime-types uses Ryan Davis’s [Hoe][] to manage the release process, and it adds
|
27
|
+
a number of rake tasks. You will mostly be interested in `rake`, which runs the
|
28
|
+
tests the same way that `rake test` will do.
|
29
29
|
|
30
30
|
To assist with the installation of the development dependencies for
|
31
31
|
mime-types, I have provided the simplest possible Gemfile pointing to the
|
32
|
-
(generated) `mime-types.gemspec` file. This will permit you to do `bundle
|
33
|
-
install` to get the development dependencies. If you aleady have `hoe`
|
32
|
+
(generated) `mime-types.gemspec` file. This will permit you to do `bundle install` to get the development dependencies. If you already have `hoe`
|
34
33
|
installed, you can accomplish the same thing with `rake newb`.
|
35
34
|
|
36
35
|
This task will install any missing dependencies, run the tests/specs, and
|
37
36
|
generate the RDoc.
|
38
37
|
|
39
|
-
You can run tests with code coverage analysis by running `rake
|
40
|
-
test:coverage`.
|
38
|
+
You can run tests with code coverage analysis by running `rake test:coverage`.
|
41
39
|
|
42
40
|
## Benchmarks
|
43
41
|
|
@@ -52,7 +50,7 @@ built-in benchmark library:
|
|
52
50
|
|
53
51
|
There are two allocation tracing benchmarks (for normal and columnar loads).
|
54
52
|
These can only be run on Ruby 2.1 or better and requires the
|
55
|
-
[allocation\_tracer] gem (not installed by default).
|
53
|
+
[allocation\_tracer][] gem (not installed by default).
|
56
54
|
|
57
55
|
- `rake benchmark:allocations`
|
58
56
|
- `rake benchmark:allocations:columnar`
|
@@ -84,6 +82,7 @@ Here's the most direct way to get your work merged into the project:
|
|
84
82
|
Thanks to everyone else who has contributed to mime-types over the years:
|
85
83
|
|
86
84
|
- Aaron Patterson
|
85
|
+
- Alex Vondrak
|
87
86
|
- Aggelos Avgerinos
|
88
87
|
- Al Snow
|
89
88
|
- Andre Pankratz
|
data/History.md
CHANGED
@@ -1,8 +1,43 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 3.5.0 / 2023-08-07
|
4
|
+
|
5
|
+
- 1 minor enhancement:
|
6
|
+
|
7
|
+
- Robb Shecter changed the default log level for duplicate type variant from
|
8
|
+
`warn` to `debug` in [#170][]. This works because `MIME::Types.logger` is
|
9
|
+
intended to fit the `::Logger` interface, and the default logger
|
10
|
+
(`WarnLogger`) is a subclass of `::Logger` that passes through to
|
11
|
+
`Kernel.warn`.
|
12
|
+
|
13
|
+
- Further consideration has changed cache load messages from `warn` to
|
14
|
+
`error` and deprecation messages from `warn` to `debug`.
|
15
|
+
|
16
|
+
- 1 bug fix:
|
17
|
+
|
18
|
+
- Added a definition of `MIME::Type#hash`. Contributed by Alex Vondrak in
|
19
|
+
[#167][], fixing [#166][].
|
20
|
+
|
21
|
+
- Dependency and CI updates:
|
22
|
+
|
23
|
+
- Update the .github/workflows/ci.yml workflow to test Ruby 3.2 and more
|
24
|
+
reliably test certain combinations rather than depending on exclusions.
|
25
|
+
|
26
|
+
- Change `.standard.yml` configuration to format for Ruby 2.3 as certain files
|
27
|
+
are not properly detected with Ruby 2.0.
|
28
|
+
|
29
|
+
- Change from `hoe-git` to `hoe-git2` to support Hoe version 4.
|
30
|
+
|
31
|
+
- Apply `standardrb --fix`.
|
32
|
+
|
33
|
+
- The above changes have resulted in the Soft deprecation of Ruby versions
|
34
|
+
below 2.6. Any errors reported for Ruby versions 2.0, 2.1, 2.2, 2.3, 2.4,
|
35
|
+
and 2.5 will be resolved, but maintaining CI for these versions is
|
36
|
+
unsustainable.
|
37
|
+
|
3
38
|
## 3.4.1 / 2021-11-16
|
4
39
|
|
5
|
-
- 1
|
40
|
+
- 1 bug fix:
|
6
41
|
|
7
42
|
- Fixed a Ruby < 2.3 incompatibility introduced by the use of standardrb,
|
8
43
|
where `<<-` heredocs were converted to `<<~` heredocs. These have been
|
@@ -26,7 +61,7 @@
|
|
26
61
|
- Added Ruby 3.0 to the CI test matrix. Added `windows/jruby` to the
|
27
62
|
CI exclusion list; it refuses to run successfully.
|
28
63
|
- Removed the Travis CI configuration and changed it to Github Workflows
|
29
|
-
[#150]. Removed Coveralls configuration.
|
64
|
+
[#150][]. Removed Coveralls configuration.
|
30
65
|
- Igor Victor added TruffleRuby to the Travis CI configuration. [#149]
|
31
66
|
- Koichi ITO loosened an excessively tight dependency. [#147]
|
32
67
|
- Started using `standardrb` for Ruby formatting and validation.
|
@@ -34,7 +69,7 @@
|
|
34
69
|
|
35
70
|
## 3.3.1 / 2019-12-26
|
36
71
|
|
37
|
-
- 1 minor
|
72
|
+
- 1 minor bug fix:
|
38
73
|
|
39
74
|
- Al Snow fixed a warning with MIME::Types::Logger producing a warning
|
40
75
|
because Ruby 2.7 introduces numbered block parameters. Because of the way
|
@@ -44,7 +79,7 @@
|
|
44
79
|
|
45
80
|
- Administrivia:
|
46
81
|
|
47
|
-
- Olle Jonsson removed an outdated Travis configuration option
|
82
|
+
- Olle Jonsson removed an outdated Travis configuration option. [#142][]
|
48
83
|
|
49
84
|
## 3.3 / 2019-09-04
|
50
85
|
|
@@ -79,8 +114,9 @@
|
|
79
114
|
to be in the same family even if strict sorting would cause an
|
80
115
|
unregistered type to be sorted first. [#132]
|
81
116
|
|
82
|
-
- Dillon Welch contributed a change that added `frozen_string_literal: true`
|
83
|
-
|
117
|
+
- Dillon Welch contributed a change that added `frozen_string_literal: true`
|
118
|
+
to files so that modern Rubies can automatically reduce duplicate string
|
119
|
+
allocations. [#135]
|
84
120
|
|
85
121
|
- 2 bug fixes
|
86
122
|
|
@@ -91,7 +127,7 @@
|
|
91
127
|
because when Enumerable#inject isn't provided a starting value, the first
|
92
128
|
value is used as the default value. In every case where this error was
|
93
129
|
happening, the result was supposed to be an array containing Set objects
|
94
|
-
so they can be reduced to a single Set. [#117], [#127], [#134]
|
130
|
+
so they can be reduced to a single Set. [#117][], [#127][], [#134][]
|
95
131
|
|
96
132
|
- Fixed an uncontrolled growth bug in MIME::Types::Container where a key
|
97
133
|
miss would create a new entry with an empty Set in the container. This
|
@@ -113,12 +149,12 @@
|
|
113
149
|
- The history file has been modified to remove all history prior to 3.0.
|
114
150
|
This history can be found in previous commits.
|
115
151
|
|
116
|
-
- A spelling error was corrected by Edward Betts ([#129]).
|
152
|
+
- A spelling error was corrected by Edward Betts ([#129][]).
|
117
153
|
|
118
154
|
- Administrivia:
|
119
155
|
|
120
156
|
- CI configuration for more modern versions of Ruby were added by Nicolas
|
121
|
-
Leger ([#130]), Jun Aruga ([#125]), and Austin Ziegler. Removed
|
157
|
+
Leger ([#130][]), Jun Aruga ([#125][]), and Austin Ziegler. Removed
|
122
158
|
ruby-head-clang and rbx (Rubinius) from CI.
|
123
159
|
|
124
160
|
- Fixed tests which were asserting equality against nil, which will become
|
@@ -129,18 +165,18 @@
|
|
129
165
|
- 1 documentation change:
|
130
166
|
|
131
167
|
- Tim Smith (@tas50) updated the build badges to be SVGs to improve
|
132
|
-
readability on high-density (retina) screens with pull request [#112].
|
168
|
+
readability on high-density (retina) screens with pull request [#112][].
|
133
169
|
|
134
170
|
- 3 bug fixes
|
135
171
|
|
136
172
|
- A test for `MIME::Types::Cache` fails under Ruby 2.3 because of frozen
|
137
|
-
strings, [#118]. This has been fixed.
|
173
|
+
strings, [#118][]. This has been fixed.
|
138
174
|
|
139
175
|
- The JSON data has been incorrectly encoded since the release of
|
140
176
|
mime-types 3 on the `xrefs` field, because of the switch to using a Set
|
141
177
|
to store cross-reference information. This has been fixed.
|
142
178
|
|
143
|
-
- A tentative fix for [#117] has been applied, removing the only circular
|
179
|
+
- A tentative fix for [#117][] has been applied, removing the only circular
|
144
180
|
require dependencies that exist (and for which there was code to prevent,
|
145
181
|
but the current fix is simpler). I have no way to verify this fix and
|
146
182
|
depending on how things are loaded by `delayed_job`, this fix may not be
|
@@ -155,22 +191,22 @@
|
|
155
191
|
- 2 governance changes
|
156
192
|
|
157
193
|
- This project and the related mime-types-data project are now exclusively
|
158
|
-
MIT licensed. Resolves [#95].
|
194
|
+
MIT licensed. Resolves [#95][].
|
159
195
|
|
160
196
|
- All projects under the mime-types organization now have a standard code
|
161
|
-
of conduct adapted from the [Contributor Covenant]. This text can be
|
162
|
-
found in the [Code-of-Conduct.md] file.
|
197
|
+
of conduct adapted from the [Contributor Covenant][]. This text can be
|
198
|
+
found in the [Code-of-Conduct.md][] file.
|
163
199
|
|
164
200
|
- 3 major changes
|
165
201
|
|
166
202
|
- All methods deprecated in mime-types 2.x have been removed.
|
167
203
|
|
168
204
|
- mime-types now requires Ruby 2.0 compatibility or later. Resolves
|
169
|
-
[#97].
|
205
|
+
[#97][].
|
170
206
|
|
171
207
|
- The registry data has been removed from mime-types and put into
|
172
208
|
mime-types-data, maintained and released separately. It can be found at
|
173
|
-
[mime-types-data].
|
209
|
+
[mime-types-data][].
|
174
210
|
|
175
211
|
- 17 minor changes:
|
176
212
|
|
@@ -183,8 +219,9 @@
|
|
183
219
|
`x-` prefixes.
|
184
220
|
|
185
221
|
- Improved initialization with an Array works so that extensions do not
|
186
|
-
need to be wrapped in another array. This means that
|
187
|
-
|
222
|
+
need to be wrapped in another array. This means that
|
223
|
+
`%w(text/yaml yaml yml)` works in the same way that
|
224
|
+
`['text/yaml', %w(yaml yml)]` did (and still does).
|
188
225
|
|
189
226
|
- Changed `priority_compare` to conform with attributes that no longer
|
190
227
|
exist.
|
@@ -192,8 +229,8 @@
|
|
192
229
|
- Changed the internal implementation of extensions to use a frozen Set.
|
193
230
|
|
194
231
|
- When extensions are set or modified with `add_extensions`, the primary
|
195
|
-
registry will be informed of a need to
|
196
|
-
[#84].
|
232
|
+
registry will be informed of a need to re-index extensions. Resolves
|
233
|
+
[#84][].
|
197
234
|
|
198
235
|
- The preferred extension can be set explicitly. If not set, it will be
|
199
236
|
the first extension. If the preferred extension is not in the extension
|
@@ -216,7 +253,7 @@
|
|
216
253
|
- Extracted the class methods to a separate file.
|
217
254
|
|
218
255
|
- Changed the container implementation to use a Set instead of an Array
|
219
|
-
to prevent data duplication. Resolves [#79].
|
256
|
+
to prevent data duplication. Resolves [#79][].
|
220
257
|
|
221
258
|
- `MIME::Types::Cache` changes:
|
222
259
|
|
@@ -235,7 +272,7 @@
|
|
235
272
|
|
236
273
|
- The registry is default loaded from the columnar store by default. The
|
237
274
|
internal format of the columnar store has changed; many of the boolean
|
238
|
-
flags are now loaded from a single file. Resolves [#85].
|
275
|
+
flags are now loaded from a single file. Resolves [#85][].
|
239
276
|
|
240
277
|
[#79]: https://github.com/mime-types/ruby-mime-types/pull/79
|
241
278
|
[#84]: https://github.com/mime-types/ruby-mime-types/pull/84
|
@@ -264,6 +301,9 @@
|
|
264
301
|
[#149]: https://github.com/mime-types/ruby-mime-types/pull/149
|
265
302
|
[#150]: https://github.com/mime-types/ruby-mime-types/pull/150
|
266
303
|
[#153]: https://github.com/mime-types/ruby-mime-types/pull/153
|
304
|
+
[#166]: https://github.com/mime-types/ruby-mime-types/issues/166
|
305
|
+
[#167]: https://github.com/mime-types/ruby-mime-types/pull/167
|
306
|
+
[#170]: https://github.com/mime-types/ruby-mime-types/pull/170
|
267
307
|
[code-of-conduct.md]: Code-of-Conduct_md.html
|
268
308
|
[contributor covenant]: http://contributor-covenant.org
|
269
309
|
[mime-types-data]: https://github.com/mime-types/mime-types-data
|
data/Manifest.txt
CHANGED
data/README.rdoc
CHANGED
@@ -5,7 +5,7 @@ code :: https://github.com/mime-types/ruby-mime-types/
|
|
5
5
|
bugs :: https://github.com/mime-types/ruby-mime-types/issues
|
6
6
|
rdoc :: http://rdoc.info/gems/mime-types/
|
7
7
|
clog :: https://github.com/mime-types/ruby-mime-types/blob/master/History.md
|
8
|
-
continuous integration :: {<img src="https://
|
8
|
+
continuous integration :: {<img src="https://github.com/mime-types/ruby-mime-types/actions/workflows/ci.yml/badge.svg" alt="Build Status" />}[https://github.com/mime-types/ruby-mime-types/actions/workflows/ci.yml]
|
9
9
|
test coverage :: {<img src="https://coveralls.io/repos/mime-types/ruby-mime-types/badge.svg?branch=master&service=github" alt="Coverage Status" />}[https://coveralls.io/github/mime-types/ruby-mime-types?branch=master]
|
10
10
|
|
11
11
|
== Description
|
data/Rakefile
CHANGED
@@ -1,78 +1,40 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
1
|
require "rubygems"
|
4
2
|
require "hoe"
|
5
3
|
require "rake/clean"
|
6
4
|
|
7
|
-
|
8
|
-
class Hoe
|
9
|
-
def with_config
|
10
|
-
config = Hoe::DEFAULT_CONFIG
|
11
|
-
|
12
|
-
rc = File.expand_path("~/.hoerc")
|
13
|
-
homeconfig = load_config(rc)
|
14
|
-
config = config.merge(homeconfig)
|
15
|
-
|
16
|
-
localconfig = load_config(File.expand_path(File.join(Dir.pwd, ".hoerc")))
|
17
|
-
config = config.merge(localconfig)
|
18
|
-
|
19
|
-
yield config, rc
|
20
|
-
end
|
21
|
-
|
22
|
-
def load_config(name)
|
23
|
-
File.exist?(name) ? safe_load_yaml(name) : {}
|
24
|
-
end
|
25
|
-
|
26
|
-
def safe_load_yaml(name)
|
27
|
-
return safe_load_yaml_file(name) if YAML.respond_to?(:safe_load_file)
|
28
|
-
|
29
|
-
data = IO.binread(name)
|
30
|
-
YAML.safe_load(data, permitted_classes: [Regexp])
|
31
|
-
rescue
|
32
|
-
YAML.safe_load(data, [Regexp])
|
33
|
-
end
|
34
|
-
|
35
|
-
def safe_load_yaml_file(name)
|
36
|
-
YAML.safe_load_file(name, permitted_classes: [Regexp])
|
37
|
-
rescue
|
38
|
-
YAML.safe_load_file(name, [Regexp])
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
5
|
+
Hoe.plugin :cov
|
42
6
|
Hoe.plugin :doofus
|
43
7
|
Hoe.plugin :gemspec2
|
44
|
-
Hoe.plugin :
|
8
|
+
Hoe.plugin :git2
|
45
9
|
Hoe.plugin :minitest
|
46
|
-
Hoe.plugin :
|
10
|
+
Hoe.plugin :rubygems
|
47
11
|
|
48
12
|
spec = Hoe.spec "mime-types" do
|
49
13
|
developer("Austin Ziegler", "halostatue@gmail.com")
|
50
|
-
self.need_tar = true
|
51
|
-
|
52
|
-
require_ruby_version ">= 2.0"
|
53
14
|
|
54
15
|
self.history_file = "History.md"
|
55
16
|
self.readme_file = "README.rdoc"
|
56
17
|
|
57
18
|
license "MIT"
|
58
19
|
|
20
|
+
require_ruby_version ">= 2.0"
|
21
|
+
|
22
|
+
spec_extras[:metadata] = ->(val) { val["rubygems_mfa_required"] = "true" }
|
23
|
+
|
59
24
|
extra_deps << ["mime-types-data", "~> 3.2015"]
|
60
25
|
|
26
|
+
extra_dev_deps << ["hoe", ">= 3.0", "< 5"]
|
61
27
|
extra_dev_deps << ["hoe-doofus", "~> 1.0"]
|
62
28
|
extra_dev_deps << ["hoe-gemspec2", "~> 1.1"]
|
63
|
-
extra_dev_deps << ["hoe-
|
29
|
+
extra_dev_deps << ["hoe-git2", "~> 1.7"]
|
64
30
|
extra_dev_deps << ["hoe-rubygems", "~> 1.0"]
|
65
|
-
extra_dev_deps << ["
|
66
|
-
extra_dev_deps << ["minitest", "~> 5.4"]
|
31
|
+
extra_dev_deps << ["minitest", "~> 5.0"]
|
67
32
|
extra_dev_deps << ["minitest-autotest", "~> 1.0"]
|
68
|
-
extra_dev_deps << ["minitest-focus", "~> 1.0"]
|
69
33
|
extra_dev_deps << ["minitest-bonus-assertions", "~> 3.0"]
|
34
|
+
extra_dev_deps << ["minitest-focus", "~> 1.0"]
|
70
35
|
extra_dev_deps << ["minitest-hooks", "~> 1.4"]
|
71
36
|
extra_dev_deps << ["rake", ">= 10.0", "< 14.0"]
|
72
|
-
|
73
|
-
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.0")
|
74
|
-
extra_dev_deps << ["simplecov", "~> 0.7"]
|
75
|
-
end
|
37
|
+
extra_dev_deps << ["standard", "~> 1.0"]
|
76
38
|
end
|
77
39
|
|
78
40
|
namespace :benchmark do
|
@@ -235,9 +197,7 @@ namespace :convert do
|
|
235
197
|
|
236
198
|
file mark => [rdoc, :setup] do |t|
|
237
199
|
puts "#{rdoc} => #{mark}"
|
238
|
-
File.
|
239
|
-
target.write @doc_converter.convert(IO.read(t.prerequisites.first))
|
240
|
-
}
|
200
|
+
File.binwrite(t.name, @doc_converter.convert(IO.read(t.prerequisites.first)))
|
241
201
|
end
|
242
202
|
|
243
203
|
CLEAN.add mark
|
data/lib/mime/type.rb
CHANGED
@@ -93,7 +93,7 @@ class MIME::Type
|
|
93
93
|
end
|
94
94
|
|
95
95
|
# The released version of the mime-types library.
|
96
|
-
VERSION = "3.
|
96
|
+
VERSION = "3.5.0"
|
97
97
|
|
98
98
|
include Comparable
|
99
99
|
|
@@ -224,6 +224,32 @@ class MIME::Type
|
|
224
224
|
other.is_a?(MIME::Type) && (self == other)
|
225
225
|
end
|
226
226
|
|
227
|
+
# Returns a hash based on the #simplified value.
|
228
|
+
#
|
229
|
+
# This maintains the invariant that two #eql? instances must have the same
|
230
|
+
# #hash (although having the same #hash does *not* imply that the objects are
|
231
|
+
# #eql?).
|
232
|
+
#
|
233
|
+
# To see why, suppose a MIME::Type instance +a+ is compared to another object
|
234
|
+
# +b+, and that <code>a.eql?(b)</code> is true. By the definition of #eql?,
|
235
|
+
# we know the following:
|
236
|
+
#
|
237
|
+
# 1. +b+ is a MIME::Type instance itself.
|
238
|
+
# 2. <code>a == b</code> is true.
|
239
|
+
#
|
240
|
+
# Due to the first point, we know that +b+ should respond to the #simplified
|
241
|
+
# method. Thus, per the definition of #<=>, we know that +a.simplified+ must
|
242
|
+
# be equal to +b.simplified+, as compared by the <=> method corresponding to
|
243
|
+
# +a.simplified+.
|
244
|
+
#
|
245
|
+
# Presumably, if <code>a.simplified <=> b.simplified</code> is +0+, then
|
246
|
+
# +a.simplified+ has the same hash as +b.simplified+. So we assume it's
|
247
|
+
# suitable for #hash to delegate to #simplified in service of the #eql?
|
248
|
+
# invariant.
|
249
|
+
def hash
|
250
|
+
simplified.hash
|
251
|
+
end
|
252
|
+
|
227
253
|
# Returns the whole MIME content-type string.
|
228
254
|
#
|
229
255
|
# The content type is a presentation value from the MIME type registry and
|
@@ -338,7 +364,7 @@ class MIME::Type
|
|
338
364
|
|
339
365
|
# Returns the default encoding for the MIME::Type based on the media type.
|
340
366
|
def default_encoding
|
341
|
-
@media_type == "text" ? "quoted-printable" : "base64"
|
367
|
+
(@media_type == "text") ? "quoted-printable" : "base64"
|
342
368
|
end
|
343
369
|
|
344
370
|
##
|
data/lib/mime/types/cache.rb
CHANGED
@@ -22,13 +22,13 @@ class << MIME::Types::Cache
|
|
22
22
|
if cache.version == MIME::Types::Data::VERSION
|
23
23
|
Marshal.load(cache.data)
|
24
24
|
else
|
25
|
-
MIME::Types.logger.
|
25
|
+
MIME::Types.logger.error <<-WARNING.chomp.strip
|
26
26
|
Could not load MIME::Types cache: invalid version
|
27
27
|
WARNING
|
28
28
|
nil
|
29
29
|
end
|
30
30
|
rescue => e
|
31
|
-
MIME::Types.logger.
|
31
|
+
MIME::Types.logger.error <<-WARNING.chomp.strip
|
32
32
|
Could not load MIME::Types cache: #{e}
|
33
33
|
WARNING
|
34
34
|
nil
|
@@ -49,10 +49,6 @@ class << MIME::Types::Cache
|
|
49
49
|
|
50
50
|
types ||= MIME::Types.send(:__types__)
|
51
51
|
|
52
|
-
File.
|
53
|
-
f.write(
|
54
|
-
Marshal.dump(new(MIME::Types::Data::VERSION, Marshal.dump(types)))
|
55
|
-
)
|
56
|
-
end
|
52
|
+
File.binwrite(cache_file, Marshal.dump(new(MIME::Types::Data::VERSION, Marshal.dump(types))))
|
57
53
|
end
|
58
54
|
end
|
@@ -10,22 +10,22 @@ module MIME
|
|
10
10
|
def self.deprecated(klass, sym, message = nil, &block) # :nodoc:
|
11
11
|
level =
|
12
12
|
case klass
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
when Class, Module
|
14
|
+
"."
|
15
|
+
else
|
16
|
+
klass = klass.class
|
17
|
+
"#"
|
18
18
|
end
|
19
19
|
message =
|
20
20
|
case message
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
21
|
+
when :private, :protected
|
22
|
+
"and will be #{message}"
|
23
|
+
when nil
|
24
|
+
"and will be removed"
|
25
|
+
else
|
26
|
+
message
|
27
27
|
end
|
28
|
-
MIME::Types.logger.
|
28
|
+
MIME::Types.logger.debug <<-WARNING.chomp.strip
|
29
29
|
#{caller(2..2).first}: #{klass}#{level}#{sym} is deprecated #{message}.
|
30
30
|
WARNING
|
31
31
|
|
data/lib/mime/types/registry.rb
CHANGED
@@ -45,7 +45,7 @@ class << MIME::Types
|
|
45
45
|
def lazy_load?
|
46
46
|
return unless ENV.key?("RUBY_MIME_TYPES_LAZY_LOAD")
|
47
47
|
|
48
|
-
MIME::Types.logger.
|
48
|
+
MIME::Types.logger.debug <<-WARNING.chomp.strip
|
49
49
|
Lazy loading ($RUBY_MIME_TYPES_LAZY_LOAD) is deprecated and will be removed.
|
50
50
|
WARNING
|
51
51
|
|
data/lib/mime/types.rb
CHANGED
@@ -125,12 +125,12 @@ class MIME::Types
|
|
125
125
|
def [](type_id, complete: false, registered: false)
|
126
126
|
matches =
|
127
127
|
case type_id
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
128
|
+
when MIME::Type
|
129
|
+
@type_variants[type_id.simplified]
|
130
|
+
when Regexp
|
131
|
+
match(type_id)
|
132
|
+
else
|
133
|
+
@type_variants[MIME::Type.simplified(type_id)]
|
134
134
|
end
|
135
135
|
|
136
136
|
prune_matches(matches, complete, registered).sort { |a, b|
|
@@ -187,7 +187,7 @@ class MIME::Types
|
|
187
187
|
# truthy value to suppress that warning.
|
188
188
|
def add_type(type, quiet = false)
|
189
189
|
if !quiet && @type_variants[type.simplified].include?(type)
|
190
|
-
MIME::Types.logger.
|
190
|
+
MIME::Types.logger.debug <<-WARNING.chomp.strip
|
191
191
|
Type #{type} is already registered as a variant of #{type.simplified}.
|
192
192
|
WARNING
|
193
193
|
end
|
data/test/test_mime_type.rb
CHANGED
@@ -266,7 +266,27 @@ describe MIME::Type do
|
|
266
266
|
end
|
267
267
|
|
268
268
|
it "is true for an equivalent MIME::Type" do
|
269
|
-
assert text_plain
|
269
|
+
assert text_plain.eql?(mime_type("text/Plain"))
|
270
|
+
end
|
271
|
+
|
272
|
+
it "is true for an equivalent subclass of MIME::Type" do
|
273
|
+
subclass = Class.new(MIME::Type)
|
274
|
+
assert text_plain.eql?(subclass.new("text/plain"))
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
278
|
+
describe "#hash" do
|
279
|
+
it "is the same between #eql? MIME::Type instances" do
|
280
|
+
assert_equal text_plain.hash, mime_type("text/plain").hash
|
281
|
+
end
|
282
|
+
|
283
|
+
it "is the same between #eql? MIME::Type instances of different classes" do
|
284
|
+
subclass = Class.new(MIME::Type)
|
285
|
+
assert_equal text_plain.hash, subclass.new("text/plain").hash
|
286
|
+
end
|
287
|
+
|
288
|
+
it "uses the #simplified value" do
|
289
|
+
assert_equal text_plain.hash, mime_type("text/Plain").hash
|
270
290
|
end
|
271
291
|
end
|
272
292
|
|
@@ -67,7 +67,7 @@ describe MIME::Types::Cache do
|
|
67
67
|
it "outputs an error when there is a marshal file incompatibility" do
|
68
68
|
MIME::Types::Cache.save
|
69
69
|
data = File.binread(@cache_file).reverse
|
70
|
-
File.
|
70
|
+
File.binwrite(@cache_file, data)
|
71
71
|
MIME::Types.instance_variable_set(:@__types__, nil)
|
72
72
|
assert_output "", /incompatible marshal file format/ do
|
73
73
|
MIME::Types["text/html"]
|
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.
|
4
|
+
version: 3.5.0
|
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: 2023-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mime-types-data
|
@@ -30,72 +30,78 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '5.
|
33
|
+
version: '5.19'
|
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.19'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: hoe
|
42
|
+
name: hoe
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3.0'
|
48
|
+
- - "<"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '5'
|
48
51
|
type: :development
|
49
52
|
prerelease: false
|
50
53
|
version_requirements: !ruby/object:Gem::Requirement
|
51
54
|
requirements:
|
52
|
-
- - "
|
55
|
+
- - ">="
|
53
56
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
57
|
+
version: '3.0'
|
58
|
+
- - "<"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '5'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: hoe-
|
62
|
+
name: hoe-doofus
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
65
|
- - "~>"
|
60
66
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1.
|
67
|
+
version: '1.0'
|
62
68
|
type: :development
|
63
69
|
prerelease: false
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
72
|
- - "~>"
|
67
73
|
- !ruby/object:Gem::Version
|
68
|
-
version: '1.
|
74
|
+
version: '1.0'
|
69
75
|
- !ruby/object:Gem::Dependency
|
70
|
-
name: hoe-
|
76
|
+
name: hoe-gemspec2
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
72
78
|
requirements:
|
73
79
|
- - "~>"
|
74
80
|
- !ruby/object:Gem::Version
|
75
|
-
version: '1.
|
81
|
+
version: '1.1'
|
76
82
|
type: :development
|
77
83
|
prerelease: false
|
78
84
|
version_requirements: !ruby/object:Gem::Requirement
|
79
85
|
requirements:
|
80
86
|
- - "~>"
|
81
87
|
- !ruby/object:Gem::Version
|
82
|
-
version: '1.
|
88
|
+
version: '1.1'
|
83
89
|
- !ruby/object:Gem::Dependency
|
84
|
-
name: hoe-
|
90
|
+
name: hoe-git2
|
85
91
|
requirement: !ruby/object:Gem::Requirement
|
86
92
|
requirements:
|
87
93
|
- - "~>"
|
88
94
|
- !ruby/object:Gem::Version
|
89
|
-
version: '1.
|
95
|
+
version: '1.7'
|
90
96
|
type: :development
|
91
97
|
prerelease: false
|
92
98
|
version_requirements: !ruby/object:Gem::Requirement
|
93
99
|
requirements:
|
94
100
|
- - "~>"
|
95
101
|
- !ruby/object:Gem::Version
|
96
|
-
version: '1.
|
102
|
+
version: '1.7'
|
97
103
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
104
|
+
name: hoe-rubygems
|
99
105
|
requirement: !ruby/object:Gem::Requirement
|
100
106
|
requirements:
|
101
107
|
- - "~>"
|
@@ -123,33 +129,33 @@ dependencies:
|
|
123
129
|
- !ruby/object:Gem::Version
|
124
130
|
version: '1.0'
|
125
131
|
- !ruby/object:Gem::Dependency
|
126
|
-
name: minitest-
|
132
|
+
name: minitest-bonus-assertions
|
127
133
|
requirement: !ruby/object:Gem::Requirement
|
128
134
|
requirements:
|
129
135
|
- - "~>"
|
130
136
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
137
|
+
version: '3.0'
|
132
138
|
type: :development
|
133
139
|
prerelease: false
|
134
140
|
version_requirements: !ruby/object:Gem::Requirement
|
135
141
|
requirements:
|
136
142
|
- - "~>"
|
137
143
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
144
|
+
version: '3.0'
|
139
145
|
- !ruby/object:Gem::Dependency
|
140
|
-
name: minitest-
|
146
|
+
name: minitest-focus
|
141
147
|
requirement: !ruby/object:Gem::Requirement
|
142
148
|
requirements:
|
143
149
|
- - "~>"
|
144
150
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
151
|
+
version: '1.0'
|
146
152
|
type: :development
|
147
153
|
prerelease: false
|
148
154
|
version_requirements: !ruby/object:Gem::Requirement
|
149
155
|
requirements:
|
150
156
|
- - "~>"
|
151
157
|
- !ruby/object:Gem::Version
|
152
|
-
version: '
|
158
|
+
version: '1.0'
|
153
159
|
- !ruby/object:Gem::Dependency
|
154
160
|
name: minitest-hooks
|
155
161
|
requirement: !ruby/object:Gem::Requirement
|
@@ -185,19 +191,19 @@ dependencies:
|
|
185
191
|
- !ruby/object:Gem::Version
|
186
192
|
version: '14.0'
|
187
193
|
- !ruby/object:Gem::Dependency
|
188
|
-
name:
|
194
|
+
name: standard
|
189
195
|
requirement: !ruby/object:Gem::Requirement
|
190
196
|
requirements:
|
191
197
|
- - "~>"
|
192
198
|
- !ruby/object:Gem::Version
|
193
|
-
version: '0
|
199
|
+
version: '1.0'
|
194
200
|
type: :development
|
195
201
|
prerelease: false
|
196
202
|
version_requirements: !ruby/object:Gem::Requirement
|
197
203
|
requirements:
|
198
204
|
- - "~>"
|
199
205
|
- !ruby/object:Gem::Version
|
200
|
-
version: '0
|
206
|
+
version: '1.0'
|
201
207
|
- !ruby/object:Gem::Dependency
|
202
208
|
name: rdoc
|
203
209
|
requirement: !ruby/object:Gem::Requirement
|
@@ -219,19 +225,19 @@ dependencies:
|
|
219
225
|
- !ruby/object:Gem::Version
|
220
226
|
version: '7'
|
221
227
|
- !ruby/object:Gem::Dependency
|
222
|
-
name:
|
228
|
+
name: simplecov
|
223
229
|
requirement: !ruby/object:Gem::Requirement
|
224
230
|
requirements:
|
225
231
|
- - "~>"
|
226
232
|
- !ruby/object:Gem::Version
|
227
|
-
version: '
|
233
|
+
version: '0.21'
|
228
234
|
type: :development
|
229
235
|
prerelease: false
|
230
236
|
version_requirements: !ruby/object:Gem::Requirement
|
231
237
|
requirements:
|
232
238
|
- - "~>"
|
233
239
|
- !ruby/object:Gem::Version
|
234
|
-
version: '
|
240
|
+
version: '0.21'
|
235
241
|
description: |-
|
236
242
|
The mime-types library provides a library and registry for information about
|
237
243
|
MIME content type definitions. It can be used to determine defined filename
|
@@ -257,6 +263,7 @@ extra_rdoc_files:
|
|
257
263
|
- Manifest.txt
|
258
264
|
- README.rdoc
|
259
265
|
files:
|
266
|
+
- ".standard.yml"
|
260
267
|
- Code-of-Conduct.md
|
261
268
|
- Contributing.md
|
262
269
|
- History.md
|
@@ -296,6 +303,7 @@ metadata:
|
|
296
303
|
source_code_uri: https://github.com/mime-types/ruby-mime-types/
|
297
304
|
bug_tracker_uri: https://github.com/mime-types/ruby-mime-types/issues
|
298
305
|
changelog_uri: https://github.com/mime-types/ruby-mime-types/blob/master/History.md
|
306
|
+
rubygems_mfa_required: 'true'
|
299
307
|
post_install_message:
|
300
308
|
rdoc_options:
|
301
309
|
- "--main"
|
@@ -313,7 +321,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
313
321
|
- !ruby/object:Gem::Version
|
314
322
|
version: '0'
|
315
323
|
requirements: []
|
316
|
-
rubygems_version: 3.
|
324
|
+
rubygems_version: 3.4.10
|
317
325
|
signing_key:
|
318
326
|
specification_version: 4
|
319
327
|
summary: The mime-types library provides a library and registry for information about
|