This commit is contained in:
VastCosmic 2024-10-28 22:13:17 +08:00 committed by GitHub
commit 9bbad742c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -147,14 +147,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: time.Now(),
})
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