|
|
|
@@ -286,9 +286,17 @@ func GetAllObsListObjectUnderDir(bucket string, prefix string) ([]FileInfo, erro |
|
|
|
input.Prefix = prefix |
|
|
|
output, err := ObsCli.ListObjects(input) |
|
|
|
fileInfos := make([]FileInfo, 0) |
|
|
|
prefixLen := len(prefix) + 1 |
|
|
|
if err == nil { |
|
|
|
for _, val := range output.Contents { |
|
|
|
var isDir bool |
|
|
|
if val.Key == prefix { |
|
|
|
continue |
|
|
|
} |
|
|
|
log.Info("sub str=" + val.Key[prefixLen:]) |
|
|
|
if strings.Contains(val.Key[prefixLen:], "/") { |
|
|
|
continue |
|
|
|
} |
|
|
|
if strings.HasSuffix(val.Key, "/") { |
|
|
|
isDir = true |
|
|
|
} else { |
|
|
|
@@ -296,7 +304,7 @@ func GetAllObsListObjectUnderDir(bucket string, prefix string) ([]FileInfo, erro |
|
|
|
} |
|
|
|
fileInfo := FileInfo{ |
|
|
|
ModTime: val.LastModified.Format("2006-01-02 15:04:05"), |
|
|
|
FileName: val.Key[len(prefix)+1:], |
|
|
|
FileName: val.Key[prefixLen:], |
|
|
|
Size: val.Size, |
|
|
|
IsDir: isDir, |
|
|
|
ParenDir: "", |
|
|
|
|