feat(cloudreve): folder size count and switch (#5457 close #5395)

This commit is contained in:
itsHenry
2023-11-04 13:35:09 +08:00
committed by GitHub
parent a6325967d0
commit 65c5ec0c34
4 changed files with 21 additions and 5 deletions

View File

@ -53,6 +53,14 @@ func (d *Cloudreve) List(ctx context.Context, dir model.Obj, args model.ListArgs
if err != nil {
return nil, err
}
if src.Type == "dir" && d.EnableThumbAndFolderSize {
var dprop DirectoryProp
err = d.request(http.MethodGet, "/object/property/"+src.Id+"?is_folder=true", nil, &dprop)
if err != nil {
return nil, err
}
src.Size = dprop.Size
}
return objectToObj(src, thumb), nil
})
}