Skip to content

Commit 08c2cbf

Browse files
authored
Merge pull request #12 from lsst-dm/IT-5635/fix-zero-length-files
fix handling of 0 size files
2 parents 2d324b5 + f537411 commit 08c2cbf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

upload/handler.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,8 @@ func (h *S3ndHandler) parseRequest(task *UploadTask, r *http.Request) error {
345345
return errors.Wrapf(err, "could not stat file %v", *task.File)
346346
}
347347
task.SizeBytes = fStat.Size()
348-
task.UploadParts = divCeil(task.SizeBytes, h.conf.UploadPartsize.Value())
348+
// if the file is empty, we still need to upload it, so set the part size to 1
349+
task.UploadParts = max(divCeil(task.SizeBytes, h.conf.UploadPartsize.Value()), 1)
349350

350351
return nil
351352
}

0 commit comments

Comments
 (0)