Skip to content

Commit af2b802

Browse files
committed
move bucket region inside block for get bucket location
1 parent 96fdcb1 commit af2b802

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

localstack-core/localstack/services/s3/provider.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -701,14 +701,15 @@ def get_bucket_location(
701701
Botocore implements this hack for parsing the response in `botocore.handlers.py#parse_get_bucket_location`
702702
"""
703703
store, s3_bucket = self._get_cross_account_bucket(context, bucket)
704-
bucket_region = s3_bucket.bucket_region
705704

706705
# TODO: Remove usage of getattr once persistence mechanism is updated.
707706
# If the stored constraint is None the bucket was made before the storage of location_constraint.
708707
# The EU location constraint wasn't supported before this point so we can safely default to the region.
709708
location_constraint = getattr(s3_bucket, "location_constraint", None)
710709
if location_constraint is None:
711-
location_constraint = bucket_region if bucket_region != "us-east-1" else ""
710+
location_constraint = (
711+
s3_bucket.bucket_region if s3_bucket.bucket_region != "us-east-1" else ""
712+
)
712713

713714
return GetBucketLocationOutput(
714715
LocationConstraint=get_bucket_location_xml(location_constraint)

0 commit comments

Comments
 (0)