From 7e5688866bb347dba13fe6feb470831ccc543dde Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Tue, 9 Nov 2021 10:55:17 +0800 Subject: [PATCH] fix bug --- modules/storage/obs.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/storage/obs.go b/modules/storage/obs.go index bd73281d0..8dbf37b76 100755 --- a/modules/storage/obs.go +++ b/modules/storage/obs.go @@ -178,6 +178,7 @@ func GetObsListObject(jobName, parentDir string) ([]FileInfo, error) { input := &obs.ListObjectsInput{} input.Bucket = setting.Bucket input.Prefix = strings.TrimPrefix(path.Join(setting.TrainJobModelPath, jobName, setting.OutPutPath, parentDir), "/") + strPrefix := strings.Split(input.Prefix, "/") output, err := ObsCli.ListObjects(input) fileInfos := make([]FileInfo, 0) if err == nil { @@ -193,6 +194,10 @@ func GetObsListObject(jobName, parentDir string) ([]FileInfo, error) { continue } } else { + //files in next level dir + if len(str1) - len(strPrefix) > 1 { + continue + } fileName = str1[len(str1)-1] isDir = false }