From a052af9a92480f31395cb4015094c34638dbefe8 Mon Sep 17 00:00:00 2001 From: Paul Gideon Dann Date: Thu, 6 Nov 2014 15:22:45 +0000 Subject: [PATCH] Rescue if IO throws exception on attempted #rewind This will permit the passing in of pipes, sockets, or other IO objects that throw exceptions when you call the #rewind method. --- lib/fog/aws/models/glacier/archive.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/fog/aws/models/glacier/archive.rb b/lib/fog/aws/models/glacier/archive.rb index 3a8946ace..c8c0b7ab3 100644 --- a/lib/fog/aws/models/glacier/archive.rb +++ b/lib/fog/aws/models/glacier/archive.rb @@ -44,7 +44,9 @@ module Fog hash = Fog::AWS::Glacier::TreeHash.new - body.rewind if body.respond_to?(:rewind) + if body.respond_to?(:rewind) + body.rewind rescue nil + end offset = 0 while (chunk = body.read(multipart_chunk_size)) do part_hash = hash.add_part(chunk)