|
|
|
@@ -353,6 +353,7 @@ func GetOneLevelAllObjectUnderDir(bucket string, prefixRootPath string, relative |
|
|
|
output, err := ObsCli.ListObjects(input) |
|
|
|
fileInfos := make([]FileInfo, 0) |
|
|
|
prefixLen := len(input.Prefix) |
|
|
|
fileMap := make(map[string]bool, 0) |
|
|
|
if err == nil { |
|
|
|
for _, val := range output.Contents { |
|
|
|
log.Info("val key=" + val.Key) |
|
|
|
@@ -362,16 +363,27 @@ func GetOneLevelAllObjectUnderDir(bucket string, prefixRootPath string, relative |
|
|
|
continue |
|
|
|
} |
|
|
|
if strings.Contains(val.Key[prefixLen:len(val.Key)-1], "/") { |
|
|
|
continue |
|
|
|
} |
|
|
|
if strings.HasSuffix(val.Key, "/") { |
|
|
|
isDir = true |
|
|
|
fileName = val.Key[prefixLen : len(val.Key)-1] |
|
|
|
relativePath += val.Key[prefixLen:] |
|
|
|
files := strings.Split(fileName, "/") |
|
|
|
fileName = files[0] |
|
|
|
isDir = true |
|
|
|
if fileMap[files[0]] { |
|
|
|
continue |
|
|
|
} else { |
|
|
|
fileMap[files[0]] = true |
|
|
|
} |
|
|
|
} else { |
|
|
|
isDir = false |
|
|
|
fileName = val.Key[prefixLen:] |
|
|
|
if strings.HasSuffix(val.Key, "/") { |
|
|
|
isDir = true |
|
|
|
fileName = val.Key[prefixLen : len(val.Key)-1] |
|
|
|
relativePath += val.Key[prefixLen:] |
|
|
|
} else { |
|
|
|
isDir = false |
|
|
|
fileName = val.Key[prefixLen:] |
|
|
|
} |
|
|
|
fileMap[fileName] = true |
|
|
|
} |
|
|
|
|
|
|
|
fileInfo := FileInfo{ |
|
|
|
ModTime: val.LastModified.Local().Format("2006-01-02 15:04:05"), |
|
|
|
FileName: fileName, |
|
|
|
|