s3: fix multpart streaming uploads of 0 length files

This commit is contained in:
Nick Craig-Wood 2023-09-03 12:37:20 +01:00
parent 2db0e23584
commit bb58040d9c

View File

@ -5427,8 +5427,8 @@ func (w *s3ChunkWriter) WriteChunk(ctx context.Context, chunkNumber int, reader
if err != nil { if err != nil {
return -1, err return -1, err
} }
// If no data read, don't write the chunk // If no data read and not the first chunk, don't write the chunk
if currentChunkSize == 0 { if currentChunkSize == 0 && chunkNumber != 0 {
return 0, nil return 0, nil
} }
md5sumBinary := m.Sum([]byte{}) md5sumBinary := m.Sum([]byte{})