s3 presigned put

This commit is contained in:
withchao 2023-07-10 18:32:25 +08:00
parent 04474c6747
commit 70b6cd360d

View File

@ -187,7 +187,8 @@ func (c *Controller) CompleteUpload(ctx context.Context, uploadID string, partHa
if uploadInfo.Size != upload.Size {
return nil, errors.New("upload size mismatching")
}
if uploadInfo.ETag != upload.Hash {
md5Sum := md5.Sum([]byte(strings.Join([]string{uploadInfo.ETag}, ",")))
if hex.EncodeToString(md5Sum[:]) != upload.Hash {
return nil, errors.New("upload md5 mismatching")
}
// 防止在这个时候,并发操作,导致文件被覆盖