balloon 1.1.3 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c867d95dbb5c4a0d87faf47ccaf9e893388b46abd615a8d9f98801241fb6bde
4
- data.tar.gz: 6f950eec27013a0f257bae84e848269c5e0a2693d9795ac622f1be572d7c4d95
3
+ metadata.gz: 513f681f29ad8f149a8c543f2843aae6c5ea763e90550729f01a86653dc0d48c
4
+ data.tar.gz: 93d672f3a2c4946ec738687da5eee0b2b27eea03d09ea6394dfc14f5132cb0c3
5
5
  SHA512:
6
- metadata.gz: 82a9c414d16d7f2435e854568d1d6be4de522e4cda381a129d4ea5deba49c95ad6507098feb18528e369576e96bc13884bd694f688632c140b15d01a3c31510a
7
- data.tar.gz: a6a4163b12edf1c43acd3bf42ea9646de72dd72644105a94a52b9cc3e4a912108519147aacd03fcb2239ee249d3d67795bdaeb674ca5d48093bffcb51a755376
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.exists?(self.path) if !path.empty?
122
+ return File.exist?(self.path) if !path.empty?
123
123
  return false
124
124
  end
125
125
 
@@ -5,7 +5,7 @@ module Balloon
5
5
  _store_path = store_path
6
6
  cache_meta = @uploader.cache_meta
7
7
 
8
- if !::File.exists? _store_path
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.exists?(path)
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.exists?(path)
58
+ FileUtils.rm(path) if ::File.exist?(path)
59
59
  end
60
60
  end
61
61
  end
@@ -18,7 +18,17 @@ module Balloon
18
18
  end
19
19
 
20
20
  def save_to_cache(up_file)
21
- uploader_file = up_file.is_a?(String) && up_file.include?("://") ? down_url(up_file) : up_file
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
- data: @cache_meta[:data]
57
+ upload_data: upload_data,
58
+ data: upload_data.merge(@cache_meta[:data])
48
59
  }
49
60
  end
50
61
 
@@ -1,3 +1,3 @@
1
1
  module Balloon
2
- VERSION = "1.1.3"
2
+ VERSION = "1.1.5"
3
3
  end
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.3
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: 2022-05-09 00:00:00.000000000 Z
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.3.7
229
+ rubygems_version: 3.4.14
230
230
  signing_key:
231
231
  specification_version: 4
232
232
  summary: Ruby image upload libary