Skip to content

Commit bab3180

Browse files
fix: missing append() API behavior (#2131)
1 parent 8a07725 commit bab3180

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

api-append-object.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ func (c *Client) appendObjectDo(ctx context.Context, bucketName, objectName stri
127127

128128
if opts.checksumType.IsSet() {
129129
reqMetadata.addCrc = &opts.checksumType
130+
reqMetadata.customHeader.Set(amzChecksumAlgo, opts.checksumType.String())
131+
if opts.checksumType.FullObjectRequested() {
132+
reqMetadata.customHeader.Set(amzChecksumMode, ChecksumFullObjectMode.String())
133+
}
130134
}
131135

132136
// Execute PUT an objectName.
@@ -183,8 +187,8 @@ func (c *Client) AppendObject(ctx context.Context, bucketName, objectName string
183187
if err != nil {
184188
return UploadInfo{}, err
185189
}
186-
if oinfo.ChecksumMode != ChecksumFullObjectMode.String() {
187-
return UploadInfo{}, fmt.Errorf("append API is not allowed on objects that are not full_object checksum type: %s", oinfo.ChecksumMode)
190+
if oinfo.ChecksumMode != "" && oinfo.ChecksumMode != ChecksumFullObjectMode.String() {
191+
return UploadInfo{}, fmt.Errorf("Append() is not allowed on objects that are not of FULL_OBJECT checksum type: %s", oinfo.ChecksumMode)
188192
}
189193
opts.setChecksumParams(oinfo) // set the appropriate checksum params based on the existing object checksum metadata.
190194
opts.setWriteOffset(oinfo.Size) // First append must set the current object size as the offset.

0 commit comments

Comments
 (0)