Skip to content

Commit 9644083

Browse files
Send Content-MD5 header on S3 uploads (#728)
Set SendContentMd5: true in PutObjectOptions so that minio-go includes a Content-MD5 header with every PutObject request. AWS S3 requires this header when the target bucket has Object Lock enabled; without it the upload is rejected with HTTP 400 (InvalidRequest). The overhead is negligible — one MD5 hash per upload — and the header also serves as a server-side integrity check for all uploads regardless of Object Lock. Fixes #727
1 parent db8cdc9 commit 9644083

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

internal/storage/s3/s3.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,9 @@ func (v *s3Storage) Name() string {
105105
func (b *s3Storage) Copy(file string) error {
106106
_, name := path.Split(file)
107107
putObjectOptions := minio.PutObjectOptions{
108-
ContentType: "application/tar+gzip",
109-
StorageClass: b.storageClass,
108+
ContentType: "application/tar+gzip",
109+
StorageClass: b.storageClass,
110+
SendContentMd5: true,
110111
}
111112

112113
if b.partSize > 0 {

0 commit comments

Comments
 (0)