filestack 2.9.0 → 2.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -3
- data/CHANGELOG.md +14 -2
- data/README.md +0 -13
- data/VERSION +1 -1
- data/docs/FilestackCommon.html +1 -1
- data/docs/MultipartUploadUtils.html +491 -491
- data/filestack-ruby.gemspec +1 -1
- data/lib/filestack/mixins/filestack_common.rb +2 -2
- data/lib/filestack/ruby/version.rb +1 -1
- data/lib/filestack/utils/multipart_upload_utils.rb +10 -2
- data/lib/filestack/utils/utils.rb +1 -1
- metadata +5 -5
data/filestack-ruby.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
|
25
25
|
spec.add_dependency "typhoeus", "~> 1.1"
|
26
26
|
spec.add_dependency "parallel", "~> 1.11", ">= 1.11.2"
|
27
|
-
spec.add_dependency "
|
27
|
+
spec.add_dependency "mini_mime", "~> 1.0"
|
28
28
|
spec.add_dependency "progress_bar"
|
29
29
|
|
30
30
|
spec.add_development_dependency "bundler", "~> 1.7"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'filestack/config'
|
2
2
|
require 'filestack/utils/utils'
|
3
3
|
require 'filestack/utils/multipart_upload_utils'
|
4
|
-
require '
|
4
|
+
require 'mini_mime'
|
5
5
|
require 'json'
|
6
6
|
|
7
7
|
# Module is mixin for common functionalities that all Filestack
|
@@ -58,7 +58,7 @@ module FilestackCommon
|
|
58
58
|
return 'Overwrite requires security' if security.nil?
|
59
59
|
|
60
60
|
file = File.open(filepath, 'r')
|
61
|
-
mimetype =
|
61
|
+
mimetype = MiniMime.lookup_by_filename(file).content_type
|
62
62
|
content = file.read
|
63
63
|
|
64
64
|
signature = security.signature
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'base64'
|
2
2
|
require 'timeout'
|
3
3
|
require 'digest'
|
4
|
-
require '
|
4
|
+
require 'mini_mime'
|
5
5
|
require 'json'
|
6
6
|
require 'parallel'
|
7
7
|
require 'typhoeus'
|
@@ -16,7 +16,7 @@ module MultipartUploadUtils
|
|
16
16
|
|
17
17
|
def get_file_attributes(file, options = {})
|
18
18
|
filename = options[:filename] || File.basename(file)
|
19
|
-
mimetype = options[:mimetype] ||
|
19
|
+
mimetype = options[:mimetype] || get_mimetype_from_file(file) || FilestackConfig::DEFAULT_UPLOAD_MIMETYPE
|
20
20
|
filesize = File.size(file)
|
21
21
|
|
22
22
|
[filename, filesize, mimetype.to_s]
|
@@ -280,4 +280,12 @@ module MultipartUploadUtils
|
|
280
280
|
end
|
281
281
|
JSON.parse(response_complete.body)
|
282
282
|
end
|
283
|
+
|
284
|
+
private
|
285
|
+
|
286
|
+
def get_mimetype_from_file(file)
|
287
|
+
file_info = MiniMime.lookup_by_filename(File.open(file))
|
288
|
+
|
289
|
+
file_info ? file_info.content_type : nil
|
290
|
+
end
|
283
291
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: filestack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.9.
|
4
|
+
version: 2.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Filestack
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -45,19 +45,19 @@ dependencies:
|
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 1.11.2
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
48
|
+
name: mini_mime
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0
|
53
|
+
version: '1.0'
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: 0
|
60
|
+
version: '1.0'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: progress_bar
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|