diff --git a/pkg/s3utils/utils.go b/pkg/s3utils/utils.go index de66fb118..ecdc5c9ce 100644 --- a/pkg/s3utils/utils.go +++ b/pkg/s3utils/utils.go @@ -31,7 +31,6 @@ import ( // Sentinel URL is the default url value which is invalid. var sentinelURL = url.URL{} -var host string // IsValidDomain validates if input string is a valid domain name. func IsValidDomain(host string) bool { @@ -224,11 +223,10 @@ func IsAmazonPrivateLinkEndpoint(endpointURL url.URL) bool { // IsGoogleEndpoint - Match if it is exactly Google cloud storage endpoint. func IsGoogleEndpoint(endpointURL url.URL) bool { - host := HasPortNumber(endpointURL) if endpointURL == sentinelURL { return false } - return host == "storage.googleapis.com" + return endpointURL.Hostname() == "storage.googleapis.com" } // Expects ascii encoded strings - from output of urlEncodePath @@ -410,14 +408,4 @@ func CheckValidObjectName(objectName string) error { return errors.New("Object name cannot be empty") } return CheckValidObjectNamePrefix(objectName) -} - -//checks for port number -func HasPortNumber(endpointURL url.URL) string { - if colonIndex := strings.LastIndex(endpointURL.Host, ":"); colonIndex != -1 { - host = endpointURL.Host[:colonIndex] - } else { - host = endpointURL.Host - } - return host -} +} \ No newline at end of file