aws-sdk-s3 1.111.1 → 1.111.3

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: 38f76aeff028d48361d6a37f648b6035f02251a9cf48fddeba1ae687bd518a10
4
- data.tar.gz: ef1db30e3ea4005a508022155596cfd0a2f99e0878845013830b3fca977235f5
3
+ metadata.gz: afe521a16dfb274ea2bffc22af08258ee2a755c2165b20cb04b2cc636e26496a
4
+ data.tar.gz: 9b8c990b785ee0e0deed43ba0a1b7db7ee29a394b7f346afe3ef2376e9199241
5
5
  SHA512:
6
- metadata.gz: 3620be3214f229605b2cc10ab633d3b73875b3b1b2b6fa379255301f892cc48a128ee4d8c8141cce33d997aa041efb4117ed7c54fa3067a94eaf81e94f8a19b5
7
- data.tar.gz: b72e254e2555044f4ff6a6a031852d0c6688f4f1a116a0f5922035781a55b431c415b160a58c78d242db8b11f300ff04e17f9f18b65c912a36e5d4ebba9aad77
6
+ metadata.gz: 869a33e38261c190235f2295dc3c2d666674f4f332fe37463337b4209da96d0bec36930292291211b86a5d3107a2342733008cafa973e4a1ddac64404afc0f17
7
+ data.tar.gz: 3a5793da1ffb76d0277085b077e3206089086df2d583da542c12bd5f173a6cbd171987a13c5cc98bd3d4bd4dbb3474048f7bdad3d740cdc5d70bf191b3799211
data/CHANGELOG.md CHANGED
@@ -1,6 +1,16 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 1.111.3 (2022-01-24)
5
+ ------------------
6
+
7
+ * Issue - Fix starts_with fields on `PresignedPost` (#2636).
8
+
9
+ 1.111.2 (2022-01-20)
10
+ ------------------
11
+
12
+ * Issue - Minor cleanups.
13
+
4
14
  1.111.1 (2022-01-06)
5
15
  ------------------
6
16
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.111.1
1
+ 1.111.3
@@ -14216,7 +14216,7 @@ module Aws::S3
14216
14216
  params: params,
14217
14217
  config: config)
14218
14218
  context[:gem_name] = 'aws-sdk-s3'
14219
- context[:gem_version] = '1.111.1'
14219
+ context[:gem_version] = '1.111.3'
14220
14220
  Seahorse::Client::Request.new(handlers, context)
14221
14221
  end
14222
14222
 
@@ -134,7 +134,7 @@ module Aws
134
134
  def write(resp)
135
135
  range, _ = resp.content_range.split(' ').last.split('/')
136
136
  head, _ = range.split('-').map {|s| s.to_i}
137
- IO.write(@path, resp.body.read, head)
137
+ File.write(@path, resp.body.read, head)
138
138
  end
139
139
 
140
140
  def single_request
@@ -176,6 +176,7 @@ module Aws
176
176
  # ```
177
177
  #
178
178
  class PresignedPost
179
+ @@allowed_fields = []
179
180
 
180
181
  # @param [Credentials] credentials Security credentials for signing
181
182
  # the post policy.
@@ -247,7 +248,12 @@ module Aws
247
248
  case option_name
248
249
  when :allow_any then allow_any(option_value)
249
250
  when :signature_expiration then @signature_expiration = option_value
250
- else send("#{option_name}", option_value)
251
+ else
252
+ if @@allowed_fields.include?(option_name)
253
+ send("#{option_name}", option_value)
254
+ else
255
+ raise ArgumentError, "Unsupported option: #{option_name}"
256
+ end
251
257
  end
252
258
  end
253
259
  end
@@ -279,17 +285,23 @@ module Aws
279
285
  end
280
286
 
281
287
  # @api private
282
- def self.define_field(field, *args)
288
+ def self.define_field(field, *args, &block)
289
+ @@allowed_fields << field
283
290
  options = args.last.is_a?(Hash) ? args.pop : {}
284
291
  field_name = args.last || field.to_s
285
292
 
286
- define_method("#{field}") do |value|
287
- with(field_name, value)
288
- end
293
+ if block_given?
294
+ define_method("#{field}", block)
295
+ else
296
+ define_method("#{field}") do |value|
297
+ with(field_name, value)
298
+ end
289
299
 
290
- if options[:starts_with]
291
- define_method("#{field}_starts_with") do |value|
292
- starts_with(field_name, value)
300
+ if options[:starts_with]
301
+ @@allowed_fields << "#{field}_starts_with".to_sym
302
+ define_method("#{field}_starts_with") do |value|
303
+ starts_with(field_name, value)
304
+ end
293
305
  end
294
306
  end
295
307
  end
@@ -307,7 +319,7 @@ module Aws
307
319
  # @param [String] key
308
320
  # @see http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html)
309
321
  # @return [self]
310
- def key(key)
322
+ define_field(:key) do |key|
311
323
  @key_set = true
312
324
  with('key', key)
313
325
  end
@@ -316,7 +328,7 @@ module Aws
316
328
  # @param [String] prefix
317
329
  # @see #key
318
330
  # @return [self]
319
- def key_starts_with(prefix)
331
+ define_field(:key_starts_with) do |prefix|
320
332
  @key_set = true
321
333
  starts_with('key', prefix)
322
334
  end
@@ -399,21 +411,21 @@ module Aws
399
411
  # @param [Time] time
400
412
  # @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21
401
413
  # @return [self]
402
- def expires(time)
414
+ define_field(:expires) do |time|
403
415
  with('Expires', time.httpdate)
404
416
  end
405
417
 
406
418
  # @param [String] prefix
407
419
  # @see #expires
408
420
  # @return [self]
409
- def expires_starts_with(prefix)
421
+ define_field(:expires_starts_with) do |prefix|
410
422
  starts_with('Expires', prefix)
411
423
  end
412
424
 
413
425
  # The minimum and maximum allowable size for the uploaded content.
414
426
  # @param [Range<Integer>] byte_range
415
427
  # @return [self]
416
- def content_length_range(byte_range)
428
+ define_field(:content_length_range) do |byte_range|
417
429
  min = byte_range.begin
418
430
  max = byte_range.end
419
431
  max -= 1 if byte_range.exclude_end?
@@ -492,7 +504,7 @@ module Aws
492
504
  # prefixed with "x-amz-meta-".
493
505
  # @param [Hash<String,String>] hash
494
506
  # @return [self]
495
- def metadata(hash)
507
+ define_field(:metadata) do |hash|
496
508
  hash.each do |key, value|
497
509
  with("x-amz-meta-#{key}", value)
498
510
  end
@@ -503,7 +515,7 @@ module Aws
503
515
  # @param [Hash<String,String>] hash
504
516
  # @see #metadata
505
517
  # @return [self]
506
- def metadata_starts_with(hash)
518
+ define_field(:metadata_starts_with) do |hash|
507
519
  hash.each do |key, value|
508
520
  starts_with("x-amz-meta-#{key}", value)
509
521
  end
@@ -561,7 +573,7 @@ module Aws
561
573
  # @param [String] value
562
574
  # @see #server_side_encryption_customer_algorithm
563
575
  # @return [self]
564
- def server_side_encryption_customer_key(value)
576
+ define_field(:server_side_encryption_customer_key) do |value|
565
577
  field_name = 'x-amz-server-side-encryption-customer-key'
566
578
  with(field_name, base64(value))
567
579
  with(field_name + '-MD5', base64(OpenSSL::Digest::MD5.digest(value)))
@@ -570,7 +582,7 @@ module Aws
570
582
  # @param [String] prefix
571
583
  # @see #server_side_encryption_customer_key
572
584
  # @return [self]
573
- def server_side_encryption_customer_key_starts_with(prefix)
585
+ define_field(:server_side_encryption_customer_key_starts_with) do |prefix|
574
586
  field_name = 'x-amz-server-side-encryption-customer-key'
575
587
  starts_with(field_name, prefix)
576
588
  end
data/lib/aws-sdk-s3.rb CHANGED
@@ -69,6 +69,6 @@ require_relative 'aws-sdk-s3/event_streams'
69
69
  # @!group service
70
70
  module Aws::S3
71
71
 
72
- GEM_VERSION = '1.111.1'
72
+ GEM_VERSION = '1.111.3'
73
73
 
74
74
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.111.1
4
+ version: 1.111.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-06 00:00:00.000000000 Z
11
+ date: 2022-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-kms