httmultipartymagic 0.3.17 → 0.3.18

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
  SHA1:
3
- metadata.gz: bb7ff01b703fb033d358dac328c9087b6163e5cd
4
- data.tar.gz: 662e5ad0e0956141106166d8ecba2b6d7d16d90f
3
+ metadata.gz: 035ac1fd8af959e1d8f18b7b8eb2fb649483f8e1
4
+ data.tar.gz: 84628535a459b9c2eee1c1ce5d61a89f4e3e4dbe
5
5
  SHA512:
6
- metadata.gz: b8efc6c37e6bee5bb144f7ed7bf03808cb344ca1356227703609bf9e136c9fb20df5d3e3da6640f1fc122d7d28b1a7d0b62b69e44d16434bb63e4ff4312f11a5
7
- data.tar.gz: f4f610fd034c8b5996d7e77c25220047db23fbdd0284c2f3d3d84ebf8b735c86f3abba8783b48d5795f679e3fec89437a5ebc3920e2b45dbb99854ecadf7515d
6
+ metadata.gz: c1f041fa44a029578b4738be96e03dd3a2cb7eeeba8f46d473f42534183dafc0c59962b1ff86e4309ee6cfefbc15cd45921c678b3860bfb565860fd8fe58fe9a
7
+ data.tar.gz: 1e3296177c69d4c5e2adf0313c97ff48b4553e2d9b9a66b5587540f6877d31ecaefbf76b9ce60f26bbb377100e866e4b80be04262e16e0ebcee978972d411c1b
@@ -15,8 +15,8 @@ module HTTMultiParty
15
15
  else
16
16
  filename = File.split(file.path).last
17
17
  end
18
- content_type = detect_mime_type ? MimeMagic.by_magic(file) : 'application/octet-stream'
19
- UploadIO.new(file, content_type, filename)
18
+
19
+ UploadIO.new(file, content_type_of(file, detect_mime_type), filename)
20
20
  end
21
21
 
22
22
  def self.query_string_normalizer(options = {})
@@ -117,6 +117,16 @@ module HTTMultiParty
117
117
  upload_io?(value)
118
118
  end
119
119
 
120
+ def self.content_type_of(file, detect_mime_type)
121
+ if detect_mime_type
122
+ type = MimeMagic.by_magic file
123
+ file.rewind
124
+ type
125
+ else
126
+ 'application/octet-stream'
127
+ end
128
+ end
129
+
120
130
  module ClassMethods
121
131
  def post(path, options = {})
122
132
  method = Net::HTTP::Post
@@ -1,3 +1,3 @@
1
1
  module HTTMultiParty
2
- VERSION = '0.3.17'
2
+ VERSION = '0.3.18'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httmultipartymagic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.17
4
+ version: 0.3.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johannes Wagener