Skip to content

Commit 151557a

Browse files
Rewind IO during initialization (#3347)
1 parent 31a794f commit 151557a

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

build_tools/services.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ class ServiceEnumerator
99
MANIFEST_PATH = File.expand_path('../../services.json', __FILE__)
1010

1111
# Minimum `aws-sdk-core` version for new gem builds
12-
MINIMUM_CORE_VERSION = "3.241.3"
12+
MINIMUM_CORE_VERSION = "3.241.4"
1313

1414
# Minimum `aws-sdk-core` version for new S3 gem builds
15-
MINIMUM_CORE_VERSION_S3 = "3.241.3"
15+
MINIMUM_CORE_VERSION_S3 = "3.241.4"
1616

1717
EVENTSTREAM_PLUGIN = "Aws::Plugins::EventStreamConfiguration"
1818

gems/aws-sdk-core/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Unreleased Changes
22
------------------
33

4+
* Issue - Rewind IO during initialization for `AwsChunkedTrailerDigestIO`.
5+
46
3.241.3 (2026-01-08)
57
------------------
68

gems/aws-sdk-core/lib/aws-sdk-core/plugins/checksum_algorithm.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ class AwsChunkedTrailerDigestIO
485485

486486
def initialize(options = {})
487487
@io = options.delete(:io)
488+
@io.rewind if @io.respond_to?(:rewind)
488489
@location_name = options.delete(:location_name)
489490
@algorithm = options.delete(:algorithm)
490491
@digest = ChecksumAlgorithm.digest_for_algorithm(@algorithm)

gems/aws-sdk-core/spec/aws/plugins/checksum_algorithm_spec.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,22 @@ def stub_client(client)
479479
expect(resp.context[:http_checksum][:validated]).to eq('CRC32')
480480
end
481481
end
482+
483+
describe 'AwsChunkedTrailerDigestIO' do
484+
it 'rewinds IO on initialization' do
485+
io = StringIO.new('hello world')
486+
io.read # move to EOF
487+
expect(io.pos).to eq(11)
488+
489+
ChecksumAlgorithm::AwsChunkedTrailerDigestIO.new(
490+
io: io,
491+
algorithm: 'CRC32',
492+
location_name: 'x-amz-checksum-crc32'
493+
)
494+
495+
expect(io.pos).to eq(0)
496+
end
497+
end
482498
end
483499
end
484500
end

0 commit comments

Comments
 (0)