Skip to content

Commit

Permalink
'AWSClient.S3ConnURICleaningDisabled' always creates a new S3 client.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Jun 7, 2023
1 parent 883dc8b commit 053922f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 7 additions & 2 deletions internal/conns/awsclient.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package conns

import (
"context"
"fmt"
"net/http"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go/service/apigatewayv2"
"github.com/aws/aws-sdk-go/service/s3"
Expand All @@ -23,8 +25,11 @@ func (client *AWSClient) RegionalHostname(prefix string) string {
return fmt.Sprintf("%s.%s.%s", prefix, client.Region, client.DNSSuffix)
}

func (client *AWSClient) S3ConnURICleaningDisabled() *s3.S3 {
return client.s3ConnURICleaningDisabled
func (client *AWSClient) S3ConnURICleaningDisabled(context.Context) *s3.S3 {
config := client.S3Conn().Config
config.DisableRestProtocolURICleaning = aws.Bool(true)

return s3.New(client.Session.Copy(&config))
}

// SetHTTPClient sets the http.Client used for AWS API calls.
Expand Down
3 changes: 0 additions & 3 deletions internal/conns/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,6 @@ func (c *Config) ConfigureProvider(ctx context.Context, client *AWSClient) (*AWS
}
client.s3Conn = s3.New(sess.Copy(s3Config))

s3Config.DisableRestProtocolURICleaning = aws.Bool(true)
client.s3ConnURICleaningDisabled = s3.New(sess.Copy(s3Config))

// "Global" services that require customizations.
globalAcceleratorConfig := &aws.Config{
Endpoint: aws.String(c.Endpoints[names.GlobalAccelerator]),
Expand Down

0 comments on commit 053922f

Please sign in to comment.