|
|
|
@ -191,11 +191,10 @@ func (c *Controller) CompleteUpload(ctx context.Context, uploadID string, partHa
|
|
|
|
|
}
|
|
|
|
|
md5Sum := md5.Sum([]byte(strings.Join([]string{uploadInfo.ETag}, partSeparator)))
|
|
|
|
|
if md5val := hex.EncodeToString(md5Sum[:]); md5val != upload.Hash {
|
|
|
|
|
log.ZInfo(ctx, "CompleteUpload UploadTypePresigned", "getEtag", uploadInfo.ETag, "upload", upload, "etag[]", md5val, "upload hash:", upload.Hash, "key:", upload.Key)
|
|
|
|
|
return nil, fmt.Errorf("md5 mismatching %s != %s -> StatObject ETag %s", md5val, upload.Hash, uploadInfo.ETag)
|
|
|
|
|
return nil, fmt.Errorf("md5 mismatching %s != %s", md5val, upload.Hash)
|
|
|
|
|
}
|
|
|
|
|
// 防止在这个时候,并发操作,导致文件被覆盖
|
|
|
|
|
copyInfo, err := c.impl.CopyObject(ctx, targetKey, upload.Key+"."+c.UUID())
|
|
|
|
|
copyInfo, err := c.impl.CopyObject(ctx, uploadInfo.Key, upload.Key+"."+c.UUID())
|
|
|
|
|
if err != nil {
|
|
|
|
|
return nil, err
|
|
|
|
|
}
|
|
|
|
|