This commit is contained in:
winwill2012 2023-10-07 06:30:58 -05:00 committed by GitHub
commit 9ce677e2c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -172,14 +172,25 @@ func (handler *Driver) List(ctx context.Context, base string, recursive bool) ([
if err != nil {
continue
}
res = append(res, response.Object{
Name: path.Base(object.Key),
Source: object.Key,
RelativePath: filepath.ToSlash(rel),
Size: uint64(object.Size),
IsDir: false,
LastModify: object.LastModified,
})
// oss sdk返回的数据在多级目录的情况下偶尔有问题有些目录被当做了文件处理
if strings.HasSuffix(object.Key, "/") {
res = append(res, response.Object{
Name: path.Base(object.Key),
RelativePath: filepath.ToSlash(rel),
Size: 0,
IsDir: true,
LastModify: time.Now(),
})
} else {
res = append(res, response.Object{
Name: path.Base(object.Key),
Source: object.Key,
RelativePath: filepath.ToSlash(rel),
Size: uint64(object.Size),
IsDir: false,
LastModify: object.LastModified,
})
}
}
return res, nil