From c35f4affa79dea5cf520dd1c954c8f32022dfb96 Mon Sep 17 00:00:00 2001 From: Marc G Gauthier Date: Mon, 25 Feb 2013 10:36:28 +0100 Subject: [PATCH] Follow redirection from response even if response is a Hash --- lib/fog/aws/storage.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fog/aws/storage.rb b/lib/fog/aws/storage.rb index a1be79ee4..0307ccdaa 100644 --- a/lib/fog/aws/storage.rb +++ b/lib/fog/aws/storage.rb @@ -400,7 +400,7 @@ DATA begin response = @connection.request(params, &block) rescue Excon::Errors::TemporaryRedirect => error - uri = URI.parse(error.response.headers['Location']) + uri = URI.parse(error.response.is_a?(Hash) ? error.response[:headers]['Location'] : error.response.headers['Location']) Fog::Logger.warning("fog: followed redirect to #{uri.host}, connecting to the matching region will be more performant") response = Fog::Connection.new("#{@scheme}://#{uri.host}:#{@port}", false, @connection_options).request(original_params, &block) end