From 3b57c1e369caa0d882ba2271dbc52d16795fb3b5 Mon Sep 17 00:00:00 2001 From: Kevin Viricel Date: Mon, 4 Oct 2021 18:03:02 +0200 Subject: [PATCH] update IsAmazonFIPSGovCloudEndpoint endpoint (#1560) --- pkg/s3utils/utils.go | 1 + pkg/s3utils/utils_test.go | 4 ++++ utils_test.go | 1 + 3 files changed, 6 insertions(+) diff --git a/pkg/s3utils/utils.go b/pkg/s3utils/utils.go index fea25d6ef..05e8b7ece 100644 --- a/pkg/s3utils/utils.go +++ b/pkg/s3utils/utils.go @@ -171,6 +171,7 @@ func IsAmazonFIPSGovCloudEndpoint(endpointURL url.URL) bool { return false } return endpointURL.Host == "s3-fips-us-gov-west-1.amazonaws.com" || + endpointURL.Host == "s3-fips.us-gov-west-1.amazonaws.com" || endpointURL.Host == "s3-fips.dualstack.us-gov-west-1.amazonaws.com" } diff --git a/pkg/s3utils/utils_test.go b/pkg/s3utils/utils_test.go index 7212e534f..5d099d114 100644 --- a/pkg/s3utils/utils_test.go +++ b/pkg/s3utils/utils_test.go @@ -54,6 +54,10 @@ func TestGetRegionFromURL(t *testing.T) { u: url.URL{Host: "s3-fips-us-gov-west-1.amazonaws.com"}, expectedRegion: "us-gov-west-1", }, + { + u: url.URL{Host: "s3-fips.us-gov-west-1.amazonaws.com"}, + expectedRegion: "us-gov-west-1", + }, { u: url.URL{Host: "s3-us-gov-west-1.amazonaws.com"}, expectedRegion: "us-gov-west-1", diff --git a/utils_test.go b/utils_test.go index e8628d229..e494bbb85 100644 --- a/utils_test.go +++ b/utils_test.go @@ -118,6 +118,7 @@ func TestIsValidEndpointURL(t *testing.T) { {"https://s3.cn-north-1.amazonaws.com.cn", nil, true}, {"https://s3-us-gov-west-1.amazonaws.com", nil, true}, {"https://s3-fips-us-gov-west-1.amazonaws.com", nil, true}, + {"https://s3-fips.us-gov-west-1.amazonaws.com", nil, true}, {"https://s3.amazonaws.com/", nil, true}, {"https://storage.googleapis.com/", nil, true}, {"https://z3.amazonaws.com", nil, true},