balloon 1.1.3 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/balloon/file_extension.rb +2 -2
- data/lib/balloon/storage/file.rb +3 -3
- data/lib/balloon/uploader.rb +13 -2
- data/lib/balloon/version.rb +1 -1
- 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: 513f681f29ad8f149a8c543f2843aae6c5ea763e90550729f01a86653dc0d48c
|
4
|
+
data.tar.gz: 93d672f3a2c4946ec738687da5eee0b2b27eea03d09ea6394dfc14f5132cb0c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 621761e559cfcf174ffca5d268e865e496e2b991a40b250718e90bf227a8f9c8dc011b8f27698c1c6c3854f7cd7f210f190828f8ac46f20ea61ecf0651f536e8
|
7
|
+
data.tar.gz: 9a31eb83c7edebeb11e936df355047bd4c5a293a9ebd840ddcb2b24247047a2b4e64ec7480b3cb9a23e7cde4a721264f942c5b3a050ec67a485abfdfdf26b245
|
@@ -98,7 +98,7 @@ module Balloon
|
|
98
98
|
def mime_type
|
99
99
|
return get_mime_type(MIME::Types[@mime_type]) if @mime_type
|
100
100
|
ext_name = split_extension(filename)[1] if !filename.blank?
|
101
|
-
return get_mime_type(MIME::Types.type_for(ext_name)) if !ext_name.blank?
|
101
|
+
return get_mime_type(MIME::Types.type_for(ext_name)) if !ext_name.blank?
|
102
102
|
if type = read_mime_type then return type end
|
103
103
|
if type = command_mime_type then return type end
|
104
104
|
end
|
@@ -119,7 +119,7 @@ module Balloon
|
|
119
119
|
end
|
120
120
|
|
121
121
|
def exists?
|
122
|
-
return File.
|
122
|
+
return File.exist?(self.path) if !path.empty?
|
123
123
|
return false
|
124
124
|
end
|
125
125
|
|
data/lib/balloon/storage/file.rb
CHANGED
@@ -5,7 +5,7 @@ module Balloon
|
|
5
5
|
_store_path = store_path
|
6
6
|
cache_meta = @uploader.cache_meta
|
7
7
|
|
8
|
-
if !::File.
|
8
|
+
if !::File.exist? _store_path
|
9
9
|
FileUtils.mkdir_p _store_path
|
10
10
|
FileUtils.chmod_R @uploader.dir_permissions.to_i, _store_path
|
11
11
|
end
|
@@ -51,11 +51,11 @@ module Balloon
|
|
51
51
|
def delete!
|
52
52
|
return false if !upload_file
|
53
53
|
path = ::File.join store_path, store_filename
|
54
|
-
FileUtils.rm(path) if ::File.
|
54
|
+
FileUtils.rm(path) if ::File.exist?(path)
|
55
55
|
if @uploader.respond_to?(:uploader_size)
|
56
56
|
@uploader.uploader_size.each do |s, o|
|
57
57
|
path = ::File.join store_path, store_filename(s)
|
58
|
-
FileUtils.rm(path) if ::File.
|
58
|
+
FileUtils.rm(path) if ::File.exist?(path)
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
data/lib/balloon/uploader.rb
CHANGED
@@ -18,7 +18,17 @@ module Balloon
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def save_to_cache(up_file)
|
21
|
-
|
21
|
+
upload_data = {}
|
22
|
+
uploader_file = up_file
|
23
|
+
|
24
|
+
if up_file.is_a?(String) && up_file.include?("://")
|
25
|
+
upload_data[:remote_url] = up_file
|
26
|
+
uploader_file = down_url(up_file)
|
27
|
+
end
|
28
|
+
|
29
|
+
if up_file.is_a?(ActionDispatch::Http::UploadedFile)
|
30
|
+
upload_data[:original_filename] = up_file.original_filename
|
31
|
+
end
|
22
32
|
|
23
33
|
uploader_file_ext = Balloon::FileExtension.new(uploader_file)
|
24
34
|
file_mime_type = uploader_file_ext.mime_type
|
@@ -44,7 +54,8 @@ module Balloon
|
|
44
54
|
size: @cache_meta[:size],
|
45
55
|
mime_type: @cache_meta[:mime_type],
|
46
56
|
extension: @cache_meta[:extension],
|
47
|
-
|
57
|
+
upload_data: upload_data,
|
58
|
+
data: upload_data.merge(@cache_meta[:data])
|
48
59
|
}
|
49
60
|
end
|
50
61
|
|
data/lib/balloon/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: balloon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yeeli
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -226,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
226
|
- !ruby/object:Gem::Version
|
227
227
|
version: '0'
|
228
228
|
requirements: []
|
229
|
-
rubygems_version: 3.
|
229
|
+
rubygems_version: 3.4.14
|
230
230
|
signing_key:
|
231
231
|
specification_version: 4
|
232
232
|
summary: Ruby image upload libary
|