fix: match CHFS preview and listing behavior

This commit is contained in:
OpenClaw Agent
2026-09-21 18:08:35 +08:00
parent 3d65a94429
commit 871e72277c
5 changed files with 48 additions and 9 deletions
+7 -1
View File
@@ -7,6 +7,7 @@ import (
"io/fs"
"os"
"path/filepath"
"sort"
"strings"
"syscall"
"time"
@@ -258,7 +259,12 @@ func (s Local) List(path string) ([]os.FileInfo, error) {
return nil, e
}
defer f.Close()
return f.Readdir(-1)
items, err := f.Readdir(-1)
if err != nil {
return nil, err
}
sort.Slice(items, func(i, j int) bool { return items[i].Name() < items[j].Name() })
return items, nil
}
var _ fs.FS