files.com 1.0.492 → 1.0.494

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: 4af3b17fbb9b516d6274bc9043462d37d6e6eab383400474a0cbd8ee84fc328d
4
+ data.tar.gz: 42734ad00e0f6630cf0abde1a786d4b526e94f02fa2404a7e11dc61a11a05c9b
5
5
  SHA512:
6
- metadata.gz: bb54f848a74021863da391761c29a296fc56eff58b064eafc614b4138281238746d49832a6695ac84885c8643c456b5aef90e6c8571b509da9b2580fb979ccf6
7
- data.tar.gz: fc2504f3ecd94b3f1635c7b3ce1f156ed68dfed519abbed24320e30bf051ecc0b3dc981265639668c87dbc27c78c3c745083ea9c9dc76c8a227e0a485698e64e
6
+ metadata.gz: d04293b3d70c648dfe82df3ed21e44674952417547991946d465abfc562d2964fb386a2c51359cba4e4528e58e5b4b225795f7f4a8a410eb0f3365ea05916c25
7
+ data.tar.gz: 5aef2aa71b0206b28c1cc88aed00c97993164bb55d2700388535d47d6d01ebf3b2d5eb4d739914b76441011e7fd6b7654750e47e43722cec3edb20da55b1b6bf
data/_VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.492
1
+ 1.0.494
@@ -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] && 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.494"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
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.494
5
5
  platform: ruby
6
6
  authors:
7
7
  - files.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-24 00:00:00.000000000 Z
11
+ date: 2023-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable