Skip to content

Commit

Permalink
Override all other regions if region is set (#624)
Browse files Browse the repository at this point in the history
Fixes #623
  • Loading branch information
harshavardhana authored and kannappanr committed Jan 31, 2018
1 parent 188dba3 commit 3aaead4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion minio/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def make_bucket(self, bucket_name, location='us-east-1'):
url = self._endpoint_url + '/' + bucket_name + '/'

# Get signature headers if any.
headers = sign_v4(method, url, 'us-east-1',
headers = sign_v4(method, url, location,
headers, self._access_key,
self._secret_key, content_sha256_hex)

Expand Down Expand Up @@ -296,6 +296,9 @@ def list_buckets(self):

# default for all requests.
region = 'us-east-1'
# region is set then use the region.
if self._region:
region = self._region

# Get signature headers if any.
headers = sign_v4(method, url, region,
Expand Down Expand Up @@ -1706,6 +1709,10 @@ def _get_bucket_location(self, bucket_name):
# default for all requests.
region = 'us-east-1'

# Region is set override.
if self._region:
return self._region

# For anonymous requests no need to get bucket location.
if self._access_key is None or self._secret_key is None:
return 'us-east-1'
Expand Down

0 comments on commit 3aaead4

Please sign in to comment.