optimize name access
Some checks failed
docker / build-docker (linux/amd64) (push) Successful in 1m53s
docker / build-docker (linux/386) (push) Successful in 2m0s
docker / build-docker (linux/arm64) (push) Has been cancelled
docker / build-docker (linux/arm/v7) (push) Has been cancelled
docker / build-docker (linux/arm64/v8) (push) Has been cancelled
Some checks failed
docker / build-docker (linux/amd64) (push) Successful in 1m53s
docker / build-docker (linux/386) (push) Successful in 2m0s
docker / build-docker (linux/arm64) (push) Has been cancelled
docker / build-docker (linux/arm/v7) (push) Has been cancelled
docker / build-docker (linux/arm64/v8) (push) Has been cancelled
This commit is contained in:
parent
bc4b39b1c1
commit
667578f048
3 changed files with 3 additions and 9 deletions
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue