files.com 1.0.492 → 1.0.493
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 +4 -4
- data/_VERSION +1 -1
- data/lib/files.com/models/file.rb +4 -2
- data/lib/files.com/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 370ee5cea2aae6cd422295923ca4753c2b7299814501e51dcc7410d92df351a3
|
4
|
+
data.tar.gz: d276fcf12dc12f9a451cecc624083a2b53b4760db638ce384a1908a04bd0f152
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 645d2f8c9942cb0bc12994340fa03c2449b6d0e604df669d91d208c24e3ca5fb453d387d1ffc7942f1043cef8f66256497d97a263a645d6633680c65cd054cfc
|
7
|
+
data.tar.gz: f458b3f4b2a230ba2100d0d09f0f6d4672e45fc5562bd180f25311f8105a4593a9612c88f3690c72f46fb1c277371d6e1d4afab5491b5a0dadcecd30587e1b5a
|
data/_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.493
|
@@ -137,9 +137,10 @@ module Files
|
|
137
137
|
def self.upload_chunks(io, path, options, upload = nil, etags = [], params: {})
|
138
138
|
etags ||= []
|
139
139
|
bytes_written = 0
|
140
|
+
request_parts = options[:size] and options[:size] < 5.megabytes ? 1 : 5
|
140
141
|
loop do
|
141
|
-
begin_upload = File.begin_upload(path, params.merge(ref: upload&.ref, part: (upload&.part_number || 0) + 1), options)
|
142
|
-
upload = begin_upload.is_a?(Enumerable) ? begin_upload.
|
142
|
+
begin_upload = File.begin_upload(path, params.merge(ref: upload&.ref, parts: request_parts, part: (upload&.part_number || 0) + 1), options) if begin_upload.nil? || begin_upload.empty?
|
143
|
+
upload = begin_upload.is_a?(Enumerable) ? begin_upload.shift : begin_upload
|
143
144
|
buf = io.read(upload.partsize) || ""
|
144
145
|
bytes_written += buf.length
|
145
146
|
method = upload.http_method.downcase.to_sym
|
@@ -152,6 +153,7 @@ module Files
|
|
152
153
|
def self.upload_file(path, destination = nil, options = {}, params: {})
|
153
154
|
local_file = ::File.open(path, 'r')
|
154
155
|
destination ||= File.basename(path)
|
156
|
+
params[:size] ||= local_file.size
|
155
157
|
upload, etags = upload_chunks(local_file, destination, options, params: params)
|
156
158
|
|
157
159
|
params = {
|
data/lib/files.com/version.rb
CHANGED