diff --git a/internal/files/disk.go b/internal/files/disk.go index 70483cc..8c8f41f 100644 --- a/internal/files/disk.go +++ b/internal/files/disk.go @@ -23,8 +23,13 @@ type DiskFile struct { func (f DiskFile) Name() string { return f.name } func (f DiskFile) Path() string { return filepath.Join(f.path, f.name) } func (f DiskFile) Date() time.Time { return f.modified } -func (f DiskFile) Filesize() int64 { return f.filesize } func (f DiskFile) IsDir() bool { return f.isdir } +func (f DiskFile) Filesize() int64 { + if f.isdir { + return -1 + } + return f.filesize +} func NewDisk(path string) (DiskFile, error) { info, err := os.Stat(path) diff --git a/internal/files/trash.go b/internal/files/trash.go index 87f898f..96dce56 100644 --- a/internal/files/trash.go +++ b/internal/files/trash.go @@ -46,8 +46,13 @@ func (t TrashInfo) TrashPath() string { return t.path } func (t TrashInfo) Path() string { return t.ogpath } func (t TrashInfo) TrashInfo() string { return t.trashinfo } func (t TrashInfo) Date() time.Time { return t.trashed } -func (t TrashInfo) Filesize() int64 { return t.filesize } func (t TrashInfo) IsDir() bool { return t.isdir } +func (t TrashInfo) Filesize() int64 { + if t.isdir { + return -1 + } + return t.filesize +} func FindTrash(trashdir, ogdir string, f *filter.Filter) (files Files, outerr error) { outerr = filepath.WalkDir(trashdir, func(path string, d fs.DirEntry, err error) error {