fs/torrentfs.go | 11 +++++++++-- diff --git a/fs/torrentfs.go b/fs/torrentfs.go index 1bcc85fa8e84edf7bb6066aa183990020bbe4fa1..47dfffc0a08caaf3caefadf57f51d29428afc3eb 100644 --- a/fs/torrentfs.go +++ b/fs/torrentfs.go @@ -78,10 +78,17 @@ func (dn dirNode) ReadDirAll(ctx context.Context) (des []fuse.Dirent, err error) { names := map[string]bool{} for _, fi := range dn.metadata.Files { - if !isSubPath(dn.path, strings.Join(fi.Path, "/")) { + filePathname := strings.Join(fi.Path, "/") + if !isSubPath(dn.path, filePathname) { continue } - name := fi.Path[len(dn.path)] + var name string + if dn.path == "" { + name = fi.Path[0] + } else { + dirPathname := strings.Split(dn.path, "/") + name = fi.Path[len(dirPathname)] + } if names[name] { continue }