@@ -2,6 +2,7 @@ package storage | |||||
import ( | import ( | ||||
"encoding/xml" | "encoding/xml" | ||||
"errors" | |||||
"path" | "path" | ||||
"sort" | "sort" | ||||
"strconv" | "strconv" | ||||
@@ -129,7 +130,7 @@ func NewMultiPartUpload(uuid string) (string, error) { | |||||
return core.NewMultipartUpload(bucketName, objectName, miniov6.PutObjectOptions{}) | return core.NewMultipartUpload(bucketName, objectName, miniov6.PutObjectOptions{}) | ||||
} | } | ||||
func CompleteMultiPartUpload(uuid string, uploadID string) (string, error) { | |||||
func CompleteMultiPartUpload(uuid string, uploadID string, totalChunks int) (string, error) { | |||||
client, core, err := getClients() | client, core, err := getClients() | ||||
if err != nil { | if err != nil { | ||||
log.Error("getClients failed:", err.Error()) | log.Error("getClients failed:", err.Error()) | ||||
@@ -146,6 +147,11 @@ func CompleteMultiPartUpload(uuid string, uploadID string) (string, error) { | |||||
return "", err | return "", err | ||||
} | } | ||||
if len(partInfos) != totalChunks { | |||||
log.Error("ListObjectParts number(%d) is not equal the set total chunk number(%d)", len(partInfos), totalChunks) | |||||
return "", errors.New("the parts is not complete") | |||||
} | |||||
var complMultipartUpload completeMultipartUpload | var complMultipartUpload completeMultipartUpload | ||||
for _, partInfo := range partInfos { | for _, partInfo := range partInfos { | ||||
complMultipartUpload.Parts = append(complMultipartUpload.Parts, miniov6.CompletePart{ | complMultipartUpload.Parts = append(complMultipartUpload.Parts, miniov6.CompletePart{ | ||||
@@ -85,7 +85,7 @@ func listAllParts(uuid, uploadID, key string) (output *obs.ListPartsOutput, err | |||||
}) | }) | ||||
} | } | ||||
if len(temp.Parts) < temp.MaxParts { | |||||
if !temp.IsTruncated { | |||||
break | break | ||||
} else { | } else { | ||||
continue | continue | ||||
@@ -128,7 +128,7 @@ func NewObsMultiPartUpload(uuid, fileName string) (string, error) { | |||||
return output.UploadId, nil | return output.UploadId, nil | ||||
} | } | ||||
func CompleteObsMultiPartUpload(uuid, uploadID, fileName string) error { | |||||
func CompleteObsMultiPartUpload(uuid, uploadID, fileName string, totalChunks int) error { | |||||
input := &obs.CompleteMultipartUploadInput{} | input := &obs.CompleteMultipartUploadInput{} | ||||
input.Bucket = setting.Bucket | input.Bucket = setting.Bucket | ||||
input.Key = strings.TrimPrefix(path.Join(setting.BasePath, path.Join(uuid[0:1], uuid[1:2], uuid, fileName)), "/") | 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 | 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 | input.Parts = allParts.Parts | ||||
output, err := ObsCli.CompleteMultipartUpload(input) | output, err := ObsCli.CompleteMultipartUpload(input) | ||||
@@ -855,13 +855,13 @@ func CompleteMultipart(ctx *context.Context) { | |||||
} | } | ||||
if typeCloudBrain == models.TypeCloudBrainOne { | if typeCloudBrain == models.TypeCloudBrainOne { | ||||
_, err = storage.CompleteMultiPartUpload(uuid, uploadID) | |||||
_, err = storage.CompleteMultiPartUpload(uuid, uploadID, fileChunk.TotalChunks) | |||||
if err != nil { | if err != nil { | ||||
ctx.Error(500, fmt.Sprintf("CompleteMultiPartUpload failed: %v", err)) | ctx.Error(500, fmt.Sprintf("CompleteMultiPartUpload failed: %v", err)) | ||||
return | return | ||||
} | } | ||||
} else { | } else { | ||||
err = storage.CompleteObsMultiPartUpload(uuid, uploadID, fileName) | |||||
err = storage.CompleteObsMultiPartUpload(uuid, uploadID, fileName, fileChunk.TotalChunks) | |||||
if err != nil { | if err != nil { | ||||
ctx.Error(500, fmt.Sprintf("CompleteObsMultiPartUpload failed: %v", err)) | ctx.Error(500, fmt.Sprintf("CompleteObsMultiPartUpload failed: %v", err)) | ||||
return | return | ||||
@@ -193,6 +193,9 @@ export default { | |||||
const time = new Date().getTime(); | const time = new Date().getTime(); | ||||
this.status = this.dropzoneParams.data('md5-computing'); | this.status = this.dropzoneParams.data('md5-computing'); | ||||
file.totalChunkCounts = chunks; | file.totalChunkCounts = chunks; | ||||
if (file.size==0) { | |||||
file.totalChunkCounts = 1 | |||||
} | |||||
loadMd5Next(); | loadMd5Next(); | ||||
fileReader.onload = (e) => { | fileReader.onload = (e) => { | ||||
@@ -3878,7 +3878,7 @@ function initVueDataset() { | |||||
}, | }, | ||||
}, | }, | ||||
components: { | components: { | ||||
MinioUploader, | |||||
MinioUploader | |||||
}, | }, | ||||
mounted(){ | mounted(){ | ||||
// if(document.getElementById('postPath')){ | // if(document.getElementById('postPath')){ | ||||
@@ -4403,7 +4403,6 @@ function initVueDataAnalysis() { | |||||
render: h => h(DataAnalysis) | render: h => h(DataAnalysis) | ||||
}); | }); | ||||
} | } | ||||
function initVueWxAutorize() { | function initVueWxAutorize() { | ||||
const el = document.getElementById('WxAutorize'); | const el = document.getElementById('WxAutorize'); | ||||
if (!el) { | if (!el) { | ||||
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》