files.com 1.0.492 → 1.0.493

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
  SHA256:
3
- metadata.gz: f15760bea0aa5c64aebfce2bc1793c6a96fee782db8486ae6730a2c4f77d6f8d
4
- data.tar.gz: fdeb6103577d0673a6c3e50a5efa5e7cbfe9cacfbb6757a1306192b95322cd08
3
+ metadata.gz: 370ee5cea2aae6cd422295923ca4753c2b7299814501e51dcc7410d92df351a3
4
+ data.tar.gz: d276fcf12dc12f9a451cecc624083a2b53b4760db638ce384a1908a04bd0f152
5
5
  SHA512:
6
- metadata.gz: bb54f848a74021863da391761c29a296fc56eff58b064eafc614b4138281238746d49832a6695ac84885c8643c456b5aef90e6c8571b509da9b2580fb979ccf6
7
- data.tar.gz: fc2504f3ecd94b3f1635c7b3ce1f156ed68dfed519abbed24320e30bf051ecc0b3dc981265639668c87dbc27c78c3c745083ea9c9dc76c8a227e0a485698e64e
6
+ metadata.gz: 645d2f8c9942cb0bc12994340fa03c2449b6d0e604df669d91d208c24e3ca5fb453d387d1ffc7942f1043cef8f66256497d97a263a645d6633680c65cd054cfc
7
+ data.tar.gz: f458b3f4b2a230ba2100d0d09f0f6d4672e45fc5562bd180f25311f8105a4593a9612c88f3690c72f46fb1c277371d6e1d4afab5491b5a0dadcecd30587e1b5a
data/_VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.492
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.first : 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 = {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Files
4
- VERSION = "1.0.492"
4
+ VERSION = "1.0.493"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: files.com
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.492
4
+ version: 1.0.493
5
5
  platform: ruby
6
6
  authors:
7
7
  - files.com