|
|
@@ -85,7 +85,7 @@ func listAllParts(uuid, uploadID, key string) (output *obs.ListPartsOutput, err |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
if len(temp.Parts) < temp.MaxParts { |
|
|
|
if !temp.IsTruncated { |
|
|
|
break |
|
|
|
} else { |
|
|
|
continue |
|
|
@@ -128,7 +128,7 @@ func NewObsMultiPartUpload(uuid, fileName string) (string, error) { |
|
|
|
return output.UploadId, nil |
|
|
|
} |
|
|
|
|
|
|
|
func CompleteObsMultiPartUpload(uuid, uploadID, fileName string) error { |
|
|
|
func CompleteObsMultiPartUpload(uuid, uploadID, fileName string, totalChunks int) error { |
|
|
|
input := &obs.CompleteMultipartUploadInput{} |
|
|
|
input.Bucket = setting.Bucket |
|
|
|
input.Key = strings.TrimPrefix(path.Join(setting.BasePath, path.Join(uuid[0:1], uuid[1:2], uuid, fileName)), "/") |
|
|
@@ -140,6 +140,11 @@ func CompleteObsMultiPartUpload(uuid, uploadID, fileName string) error { |
|
|
|
return err |
|
|
|
} |
|
|
|
|
|
|
|
if len(allParts.Parts) != totalChunks { |
|
|
|
log.Error("listAllParts number(%d) is not equal the set total chunk number(%d)", len(allParts.Parts), totalChunks) |
|
|
|
return errors.New("the parts is not complete") |
|
|
|
} |
|
|
|
|
|
|
|
input.Parts = allParts.Parts |
|
|
|
|
|
|
|
output, err := ObsCli.CompleteMultipartUpload(input) |
|
|
|