Skip to content

Commit

Permalink
Disable uri path escaping for presigned URLs (#1047)
Browse files Browse the repository at this point in the history
This is more correct wrt SDK usage in Go.

Closes #1046.
  • Loading branch information
roman-khimov authored Dec 18, 2024
2 parents b0ac82c + 1b4d0e3 commit 429a0c7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This document outlines major changes between releases.
### Added

### Changed
- Disable URI path escaping for presigned URLs (#1046)

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion api/auth/center.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ func cloneRequest(r *http.Request, authHeader *authHeader) *http.Request {
func (c *center) checkSign(authHeader *authHeader, box *accessbox.Box, request *http.Request, signatureDateTime time.Time) error {
awsCreds := credentials.NewStaticCredentials(authHeader.AccessKeyID, box.Gate.AccessKey, "")
signer := v4amz.NewSigner(awsCreds)
signer.DisableURIPathEscaping = true

var signature string
if authHeader.IsPresigned {
Expand All @@ -331,7 +332,6 @@ func (c *center) checkSign(authHeader *authHeader, box *accessbox.Box, request *
}
signature = request.URL.Query().Get(AmzSignature)
} else {
signer.DisableURIPathEscaping = true
if _, err := signer.Sign(request, nil, authHeader.Service, authHeader.Region, signatureDateTime); err != nil {
return fmt.Errorf("failed to sign temporary HTTP request: %w", err)
}
Expand Down

0 comments on commit 429a0c7

Please sign in to comment.