Skip to content

Commit 0c4bfde

Browse files
committed
Use query syntax to sub in us-east-1 for the Null region constraint of those buckets
1 parent 214f09b commit 0c4bfde

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

git-credential-s3-secrets

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ s3_bucket_region() {
7171
guess_region="us-east-1"
7272
fi
7373

74-
local bucket_region="$(aws s3api get-bucket-location --bucket "${bucket}" --region "${guess_region}" --output text)"
74+
# Buckets in us-east-1 have a LocationConstraint of null
75+
# https://docs.aws.amazon.com/cli/latest/reference/s3api/get-bucket-location.html
76+
local bucket_region="$(aws s3api get-bucket-location --bucket "${bucket}" --region "${guess_region}" --output text --query "LocationConstraint || 'us-east-1'")"
7577

7678
echo "${bucket_region}"
7779
}

0 commit comments

Comments
 (0)