1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00

Use regex instead of string matching to support redirect correctly when path_style is set to true

- Before this change a user would get an exception because the case statement
would attempt to do the else case which would get an `undefined method captures for nil class`
because the region is acutally a default region

Signed-off-by: Aakash Shah <ashah@pivotal.io>
This commit is contained in:
Derek Richard 2015-07-30 17:11:19 -07:00 committed by Aakash Shah
parent 3ffd9fa667
commit 6c02b477a3

View file

@ -606,7 +606,7 @@ module Fog
Fog::Logger.warning("fog: followed redirect to #{host}, connecting to the matching region will be more performant")
original_region, original_signer = @region, @signer
@region = @new_region || case new_params[:host]
when 's3.amazonaws.com', 's3-external-1.amazonaws.com'
when /s3.amazonaws.com/, /s3-external-1.amazonaws.com/
DEFAULT_REGION
else
%r{s3[\.\-]([^\.]*).amazonaws.com}.match(new_params[:host]).captures.first