diff --git a/src/sources/torrent/fs.go b/src/sources/torrent/fs.go index dbf87a9..ec63775 100644 --- a/src/sources/torrent/fs.go +++ b/src/sources/torrent/fs.go @@ -35,20 +35,13 @@ type TorrentFS struct { var _ vfs.Filesystem = (*TorrentFS)(nil) func (s *Daemon) NewTorrentFs(ctx context.Context, f vfs.File) (vfs.Filesystem, error) { - defer f.Close(ctx) - - info, err := f.Info() - if err != nil { - return nil, err - } - c, err := s.LoadTorrent(ctx, f) if err != nil { return nil, err } return &TorrentFS{ - name: info.Name(), + name: f.Name(), Torrent: c, resolver: vfs.NewResolver(vfs.ArchiveFactories), }, nil diff --git a/src/vfs/ctxbillyfs.go b/src/vfs/ctxbillyfs.go index f8b61a4..10df733 100644 --- a/src/vfs/ctxbillyfs.go +++ b/src/vfs/ctxbillyfs.go @@ -126,7 +126,7 @@ func (c *CtxBillyFile) IsDir() bool { // Name implements File. func (c *CtxBillyFile) Name() string { - return c.file.Name() + return c.info.Name() } // Read implements File. diff --git a/src/vfs/resolver.go b/src/vfs/resolver.go index c2e32d8..3b3c63b 100644 --- a/src/vfs/resolver.go +++ b/src/vfs/resolver.go @@ -306,6 +306,7 @@ PARTS_LOOP: if err != nil { return "", nil, "", fmt.Errorf("error opening filesystem file: %s with error: %w", fsPath, err) } + defer fsFile.Close(ctx) nestedFs, err := nestFactory(ctx, fsFile) if err != nil { return "", nil, "", fmt.Errorf("error creating filesystem from file: %s with error: %w", fsPath, err)