mime-types 3.5.0 → 3.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Contributing.md +1 -0
- data/History.md +10 -0
- data/lib/mime/type.rb +1 -1
- data/lib/mime/types.rb +1 -1
- data/test/test_mime_types.rb +4 -0
- data/test/test_mime_types_class.rb +5 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2577d95fe119a69a6462f904e9395bd3e2afe41a92e31bb278efd5978edfe450
|
4
|
+
data.tar.gz: d014796e5c1647f5a19b45b7993b390540b671fca83471e3d004712b277f3283
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 152b2f7e76b5b54c5dce0f0f97d5b0c301e4df2d71df0ba7643027d3e1015e3a3be838ceff2e49a851a3c62cd802ff2ab1473a1a62f6e359e66252204ce4bc7e
|
7
|
+
data.tar.gz: 63b40def9bdb08b5d4acc7af524746e900c6e07fb4b267e6bc816e083b59b1d7b779b3d7884494e1a8e5eea88240aa1a2c4e95e71e1be79f4fdf31dbdb251903
|
data/Contributing.md
CHANGED
data/History.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 3.5.1 / 2023-08-21
|
4
|
+
|
5
|
+
- 1 bug fix:
|
6
|
+
|
7
|
+
- Better handle possible line-termination strings (legal in Unix filenames)
|
8
|
+
such as `\n` in `MIME::Types.type_for`. Reported by ooooooo-q in [#177][],
|
9
|
+
resolved in [#178][].
|
10
|
+
|
3
11
|
## 3.5.0 / 2023-08-07
|
4
12
|
|
5
13
|
- 1 minor enhancement:
|
@@ -304,6 +312,8 @@
|
|
304
312
|
[#166]: https://github.com/mime-types/ruby-mime-types/issues/166
|
305
313
|
[#167]: https://github.com/mime-types/ruby-mime-types/pull/167
|
306
314
|
[#170]: https://github.com/mime-types/ruby-mime-types/pull/170
|
315
|
+
[#177]: https://github.com/mime-types/ruby-mime-types/issues/177
|
316
|
+
[#178]: https://github.com/mime-types/ruby-mime-types/pull/178
|
307
317
|
[code-of-conduct.md]: Code-of-Conduct_md.html
|
308
318
|
[contributor covenant]: http://contributor-covenant.org
|
309
319
|
[mime-types-data]: https://github.com/mime-types/mime-types-data
|
data/lib/mime/type.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
|
}
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Austin Ziegler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mime-types-data
|
@@ -321,7 +321,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
321
321
|
- !ruby/object:Gem::Version
|
322
322
|
version: '0'
|
323
323
|
requirements: []
|
324
|
-
rubygems_version: 3.4.
|
324
|
+
rubygems_version: 3.4.18
|
325
325
|
signing_key:
|
326
326
|
specification_version: 4
|
327
327
|
summary: The mime-types library provides a library and registry for information about
|