From 4de119e828eb7591d1b1652328d0d7d8fd75885a Mon Sep 17 00:00:00 2001 From: Richard Wang Date: Thu, 15 Jan 2026 14:01:45 -0800 Subject: [PATCH] Rewind IO during initialization --- build_tools/services.rb | 4 ++-- gems/aws-sdk-core/CHANGELOG.md | 2 ++ .../aws-sdk-core/plugins/checksum_algorithm.rb | 1 + .../spec/aws/plugins/checksum_algorithm_spec.rb | 16 ++++++++++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/build_tools/services.rb b/build_tools/services.rb index d91ae467fbd..25785d8f888 100644 --- a/build_tools/services.rb +++ b/build_tools/services.rb @@ -9,10 +9,10 @@ class ServiceEnumerator MANIFEST_PATH = File.expand_path('../../services.json', __FILE__) # Minimum `aws-sdk-core` version for new gem builds - MINIMUM_CORE_VERSION = "3.241.3" + MINIMUM_CORE_VERSION = "3.241.4" # Minimum `aws-sdk-core` version for new S3 gem builds - MINIMUM_CORE_VERSION_S3 = "3.241.3" + MINIMUM_CORE_VERSION_S3 = "3.241.4" EVENTSTREAM_PLUGIN = "Aws::Plugins::EventStreamConfiguration" diff --git a/gems/aws-sdk-core/CHANGELOG.md b/gems/aws-sdk-core/CHANGELOG.md index d11c2c38870..d78d553f147 100644 --- a/gems/aws-sdk-core/CHANGELOG.md +++ b/gems/aws-sdk-core/CHANGELOG.md @@ -1,6 +1,8 @@ Unreleased Changes ------------------ +* Issue - Rewind IO during initialization for `AwsChunkedTrailerDigestIO`. + 3.241.3 (2026-01-08) ------------------ diff --git a/gems/aws-sdk-core/lib/aws-sdk-core/plugins/checksum_algorithm.rb b/gems/aws-sdk-core/lib/aws-sdk-core/plugins/checksum_algorithm.rb index 0bb447e67a3..fe7aeafa8c5 100644 --- a/gems/aws-sdk-core/lib/aws-sdk-core/plugins/checksum_algorithm.rb +++ b/gems/aws-sdk-core/lib/aws-sdk-core/plugins/checksum_algorithm.rb @@ -485,6 +485,7 @@ class AwsChunkedTrailerDigestIO def initialize(options = {}) @io = options.delete(:io) + @io.rewind if @io.respond_to?(:rewind) @location_name = options.delete(:location_name) @algorithm = options.delete(:algorithm) @digest = ChecksumAlgorithm.digest_for_algorithm(@algorithm) diff --git a/gems/aws-sdk-core/spec/aws/plugins/checksum_algorithm_spec.rb b/gems/aws-sdk-core/spec/aws/plugins/checksum_algorithm_spec.rb index 1c4209a74d3..ca514f18c0c 100644 --- a/gems/aws-sdk-core/spec/aws/plugins/checksum_algorithm_spec.rb +++ b/gems/aws-sdk-core/spec/aws/plugins/checksum_algorithm_spec.rb @@ -479,6 +479,22 @@ def stub_client(client) expect(resp.context[:http_checksum][:validated]).to eq('CRC32') end end + + describe 'AwsChunkedTrailerDigestIO' do + it 'rewinds IO on initialization' do + io = StringIO.new('hello world') + io.read # move to EOF + expect(io.pos).to eq(11) + + ChecksumAlgorithm::AwsChunkedTrailerDigestIO.new( + io: io, + algorithm: 'CRC32', + location_name: 'x-amz-checksum-crc32' + ) + + expect(io.pos).to eq(0) + end + end end end end