mirror of
https://gitee.com/fit2cloud-feizhiyun/1Panel.git
synced 2024-12-05 13:29:11 +08:00
fit: 文件显示大小值问题修复 (#5583)
This commit is contained in:
parent
7c7d30376f
commit
d00fb2163a
@ -64,20 +64,6 @@ type FileSearchInfo struct {
|
||||
fs.FileInfo
|
||||
}
|
||||
|
||||
func getDirSize(fs afero.Fs, path string) (int64, error) {
|
||||
var size int64
|
||||
err := afero.Walk(fs, path, func(p string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !info.IsDir() {
|
||||
size += info.Size()
|
||||
}
|
||||
return nil
|
||||
})
|
||||
return size, err
|
||||
}
|
||||
|
||||
func NewFileInfo(op FileOption) (*FileInfo, error) {
|
||||
var appFs = afero.NewOsFs()
|
||||
|
||||
@ -115,11 +101,6 @@ func NewFileInfo(op FileOption) (*FileInfo, error) {
|
||||
}
|
||||
if op.Expand {
|
||||
if file.IsDir {
|
||||
size, err := getDirSize(appFs, op.Path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
file.Size = size
|
||||
if err := file.listChildren(op); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user