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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dcfb18b8a1063e841659b369decec0047b8b540769b271c665f02e5f77e8fc8e
4
- data.tar.gz: 73a977e080d43c997ceb7c62df0a91fa30bc51b4c8cc14e50e23b4895488cd59
3
+ metadata.gz: 2577d95fe119a69a6462f904e9395bd3e2afe41a92e31bb278efd5978edfe450
4
+ data.tar.gz: d014796e5c1647f5a19b45b7993b390540b671fca83471e3d004712b277f3283
5
5
  SHA512:
6
- metadata.gz: bc2c9dddfff6a9b6b74aa4997ac2c3bd3287f51231ec48c3c5cdfdbc140488aaed43348b2a3b8460d2d50e7fffb425f6bc1f3887b5cf25571b8047573ee15bfe
7
- data.tar.gz: 6fbcfac5acae5ce40781a705c2d48b650077126f4f847c14dc7c24797cd98ff9a4b886963f90ff26ed16f63533e7ea36fbc084790a1e7b2e6ba5d2004db268b2
6
+ metadata.gz: 152b2f7e76b5b54c5dce0f0f97d5b0c301e4df2d71df0ba7643027d3e1015e3a3be838ceff2e49a851a3c62cd802ff2ab1473a1a62f6e359e66252204ce4bc7e
7
+ data.tar.gz: 63b40def9bdb08b5d4acc7af524746e900c6e07fb4b267e6bc816e083b59b1d7b779b3d7884494e1a8e5eea88240aa1a2c4e95e71e1be79f4fdf31dbdb251903
data/Contributing.md CHANGED
@@ -121,6 +121,7 @@ Thanks to everyone else who has contributed to mime-types over the years:
121
121
  - Richard Hirner
122
122
  - Richard Hurt
123
123
  - Richard Schneeman
124
+ - Robb Shecter
124
125
  - Tibor Szolár
125
126
  - Todd Carrico
126
127
 
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
@@ -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.5.0"
96
+ VERSION = "3.5.1"
97
97
 
98
98
  include Comparable
99
99
 
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[/\.?([^.]*?)$/, 1]]
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
  }
@@ -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.0
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-07 00:00:00.000000000 Z
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.10
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