Skip to content

Commit

Permalink
Merge pull request #76 from cyn0/master
Browse files Browse the repository at this point in the history
Disable V4 signer URI escaping for S3 requests
  • Loading branch information
alvinlin123 authored Sep 16, 2022
2 parents 262511e + 967714e commit a628d90
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions handler/proxy_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ func (p *ProxyClient) sign(req *http.Request, service *endpoints.ResolvedEndpoin
body = bytes.NewReader(b)
}

// S3 service should not have any escaping applied.
// https://github.com/aws/aws-sdk-go/blob/main/aws/signer/v4/v4.go#L467-L470
if (service.SigningName == "s3") {
p.Signer.DisableURIPathEscaping = true

// Enable URI escaping for subsequent calls.
defer func() {
p.Signer.DisableURIPathEscaping = false
}()
}

var err error
switch service.SigningMethod {
case "v4", "s3v4":
Expand Down

0 comments on commit a628d90

Please sign in to comment.