From 788764a51fe8bec061f62ff3bb2e29090bb3d158 Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 31 May 2022 10:46:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- modules/storage/minio_ext.go | 10 +++++----- routers/repo/ai_model_manage.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/storage/minio_ext.go b/modules/storage/minio_ext.go index cbbc0179b..514ac7204 100755 --- a/modules/storage/minio_ext.go +++ b/modules/storage/minio_ext.go @@ -219,11 +219,11 @@ func GetOneLevelAllObjectUnderDirMinio(bucket string, prefixRootPath string, rel func MinioPathCopy(bucketName string, srcPath string, destPath string) (int64, error) { _, core, err := getClients() - var count int64 - count = 0 + var fileTotalSize int64 + fileTotalSize = 0 if err != nil { log.Error("getClients failed:", err.Error()) - return count, err + return fileTotalSize, err } delimiter := "" marker := "" @@ -235,7 +235,7 @@ func MinioPathCopy(bucketName string, srcPath string, destPath string) (int64, e destObjectName := destPath + srcObjectName[len(srcPath):] log.Info("srcObjectName=" + srcObjectName + " destObjectName=" + destObjectName) core.CopyObject(bucketName, srcObjectName, bucketName, destObjectName, val.UserMetadata) - count++ + fileTotalSize += val.Size } if output.IsTruncated { marker = output.NextMarker @@ -247,7 +247,7 @@ func MinioPathCopy(bucketName string, srcPath string, destPath string) (int64, e return 0, err } } - return count, nil + return fileTotalSize, nil } func NewMultiPartUpload(uuid string) (string, error) { diff --git a/routers/repo/ai_model_manage.go b/routers/repo/ai_model_manage.go index 7a02a5322..a13095d52 100644 --- a/routers/repo/ai_model_manage.go +++ b/routers/repo/ai_model_manage.go @@ -333,7 +333,7 @@ func downloadFromCloudBrainOne(path string, task *models.AiModelManage, ctx *con ctx.ServerError("download file failed:", err) return } - body, err := storage.Attachments.Open(oneFile.FileName) + body, err := storage.Attachments.Open(path + oneFile.FileName) if err != nil { log.Info("download file failed: %s\n", err.Error()) ctx.ServerError("download file failed:", err)