diff --git a/modules/modelarts/modelarts.go b/modules/modelarts/modelarts.go index 775b345ad..844f37ffb 100755 --- a/modules/modelarts/modelarts.go +++ b/modules/modelarts/modelarts.go @@ -22,7 +22,7 @@ const ( ) func GenerateTask(ctx *context.Context, jobName, uuid, description string) error { - dataActualPath := setting.Bucket + "/" + setting.BasePath + path.Join(uuid[0:1], uuid[1:2]) + "/" + dataActualPath := setting.Bucket + "/" + setting.BasePath + path.Join(uuid[0:1], uuid[1:2]) + "/" + uuid + "/" jobResult, err := CreateJob(models.CreateNotebookParams{ JobName: jobName, Description:description, diff --git a/modules/storage/obs.go b/modules/storage/obs.go index bf8fac54c..d174b8fba 100755 --- a/modules/storage/obs.go +++ b/modules/storage/obs.go @@ -37,7 +37,7 @@ func ObsHasObject(path string) (bool, error) { } func GetObsPartInfos(uuid string, uploadID string) (string, error) { - key := strings.TrimPrefix(path.Join(setting.BasePath, path.Join(uuid[0:1], uuid[1:2], uuid)), "/") + key := strings.TrimPrefix(path.Join(setting.BasePath, path.Join(uuid[0:1], uuid[1:2], uuid, uuid)), "/") output, err := ObsCli.ListParts(&obs.ListPartsInput{ Bucket: setting.Bucket, @@ -60,7 +60,7 @@ func GetObsPartInfos(uuid string, uploadID string) (string, error) { func NewObsMultiPartUpload(uuid string) (string, error) { input := &obs.InitiateMultipartUploadInput{} input.Bucket = setting.Bucket - input.Key = strings.TrimPrefix(path.Join(setting.BasePath, path.Join(uuid[0:1], uuid[1:2], uuid)), "/") + input.Key = strings.TrimPrefix(path.Join(setting.BasePath, path.Join(uuid[0:1], uuid[1:2], uuid, uuid)), "/") output, err := ObsCli.InitiateMultipartUpload(input) if err != nil { @@ -74,7 +74,7 @@ func NewObsMultiPartUpload(uuid string) (string, error) { func CompleteObsMultiPartUpload(uuid string, uploadID string) 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)), "/") + input.Key = strings.TrimPrefix(path.Join(setting.BasePath, path.Join(uuid[0:1], uuid[1:2], uuid, uuid)), "/") input.UploadId = uploadID output, err := ObsCli.ListParts(&obs.ListPartsInput{ Bucket: setting.Bucket, @@ -105,7 +105,7 @@ func CompleteObsMultiPartUpload(uuid string, uploadID string) error { func ObsUploadPart(uuid string, uploadId string, partNumber int, partSize int64, body io.Reader) (string, error) { input := &obs.UploadPartInput{} input.PartNumber = partNumber - input.Key = strings.TrimPrefix(path.Join(setting.BasePath, path.Join(uuid[0:1], uuid[1:2], uuid)), "/") + input.Key = strings.TrimPrefix(path.Join(setting.BasePath, path.Join(uuid[0:1], uuid[1:2], uuid, uuid)), "/") input.UploadId = uploadId input.Bucket = setting.Bucket input.PartSize = partSize @@ -141,7 +141,7 @@ func ObsGenMultiPartSignedUrl(uuid string, uploadId string, partNumber int, part */ - Key := strings.TrimPrefix(path.Join(setting.BasePath, path.Join(uuid[0:1], uuid[1:2], uuid)), "/") + Key := strings.TrimPrefix(path.Join(setting.BasePath, path.Join(uuid[0:1], uuid[1:2], uuid, uuid)), "/") req, err := ObsCli.CreateUploadPartSignedUrl(setting.Bucket, Key, uploadId, partNumber, partSize) if err != nil { log.Error("CreateSignedUrl failed:", err.Error()) @@ -158,7 +158,7 @@ func ObsGenMultiPartSignedUrl(uuid string, uploadId string, partNumber int, part func ObsGetPreSignedUrl(uuid, fileName string) (string, error) { input := &obs.CreateSignedUrlInput{} input.Method = obs.HttpMethodGet - input.Key = strings.TrimPrefix(path.Join(setting.BasePath, path.Join(uuid[0:1], uuid[1:2], uuid)), "/") + input.Key = strings.TrimPrefix(path.Join(setting.BasePath, path.Join(uuid[0:1], uuid[1:2], uuid, uuid)), "/") input.Bucket = setting.Bucket input.Expires = 60 * 60 diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go index ecfc8c407..6874a1eda 100755 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -309,7 +309,7 @@ func AddAttachment(ctx *context.Context) { return } } else { - has, err = storage.ObsHasObject(setting.BasePath + models.AttachmentRelativePath(uuid)) + has, err = storage.ObsHasObject(setting.BasePath + models.AttachmentRelativePath(uuid) + "/" + uuid) if err != nil { ctx.ServerError("ObsHasObject", err) return @@ -621,7 +621,7 @@ func GetMultipartUploadUrl(ctx *context.Context) { func GetObsKey(ctx *context.Context) { uuid := gouuid.NewV4().String() - key := strings.TrimPrefix(path.Join(setting.BasePath, path.Join(uuid[0:1], uuid[1:2], uuid)), "/") + key := strings.TrimPrefix(path.Join(setting.BasePath, path.Join(uuid[0:1], uuid[1:2], uuid, uuid)), "/") ctx.JSON(200, map[string]string{ "uuid": uuid,