fix: Makes the crc64nvme checksum as default for PutObject, even if no checksum is provided

Fixes #1182

S3 calculates the `CRC64NVME` checksum of an object on object upload(`PutObject`), when no checksum algorithm or precalculated checksum header is provided.
Makes the `CRC64NVME` checksum as default for `PutObject`, when no checksum is provided.
This commit is contained in:
niksis02
2025-04-04 00:08:54 +04:00
parent 90a67272a7
commit f627b2efec
3 changed files with 47 additions and 0 deletions
+4
View File
@@ -2668,6 +2668,10 @@ func (p *Posix) PutObject(ctx context.Context, po s3response.PutObjectInput) (s3
if po.Key == nil {
return s3response.PutObjectOutput{}, s3err.GetAPIError(s3err.ErrNoSuchKey)
}
// Override the checksum algorithm with default: CRC64NVME
if po.ChecksumAlgorithm == "" {
po.ChecksumAlgorithm = types.ChecksumAlgorithmCrc64nvme
}
_, err := os.Stat(*po.Bucket)
if errors.Is(err, fs.ErrNotExist) {
return s3response.PutObjectOutput{}, s3err.GetAPIError(s3err.ErrNoSuchBucket)