webdav: fix LocalFileSystem.Readdir not returning children

This commit is contained in:
Simon Ser 2020-01-22 11:14:09 +01:00
parent 6eeeccb96e
commit 83cb67070c
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -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