Skip to content

Commit

Permalink
Add Content-Md5 header only if length of md5 passed is greater than z…
Browse files Browse the repository at this point in the history
…ero (#828)

As HTTP headers do not differentiate between value not set and value
set to (""), minio-go should not differentiate between empty byte arrays ("")
and nil byte arrays, add Content-Md5 header only if length of []byte is
greater than zero

Fixes: minio/minio-java#615
  • Loading branch information
nitisht authored and deekoder committed Sep 27, 2017
1 parent 3d954df commit 414c6b6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion api.go
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ func (c Client) newRequest(method string, metadata requestMetadata) (req *http.R
}

// set md5Sum for content protection.
if metadata.contentMD5Bytes != nil {
if len(metadata.contentMD5Bytes) > 0 {
req.Header.Set("Content-Md5", base64.StdEncoding.EncodeToString(metadata.contentMD5Bytes))
}

Expand Down

0 comments on commit 414c6b6

Please sign in to comment.