mirror of
https://github.com/1f349/go-webdav.git
synced 2024-12-22 08:14:15 +00:00
webdav: fix LocalFileSystem.Readdir not returning children
This commit is contained in:
parent
6eeeccb96e
commit
83cb67070c
@ -65,13 +65,13 @@ func (fs LocalFileSystem) Stat(name string) (*FileInfo, error) {
|
||||
}
|
||||
|
||||
func (fs LocalFileSystem) Readdir(name string, recursive bool) ([]FileInfo, error) {
|
||||
p, err := fs.localPath(name)
|
||||
path, err := fs.localPath(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var l []FileInfo
|
||||
err = filepath.Walk(p, func(p string, fi os.FileInfo, err error) error {
|
||||
err = filepath.Walk(path, func(p string, fi os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -83,7 +83,7 @@ func (fs LocalFileSystem) Readdir(name string, recursive bool) ([]FileInfo, erro
|
||||
|
||||
l = append(l, *fileInfoFromOS(href, fi))
|
||||
|
||||
if !recursive && fi.IsDir() {
|
||||
if !recursive && fi.IsDir() && path != p {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user