From: Matt Joiner Date: Mon, 4 Mar 2024 05:01:22 +0000 (+1100) Subject: Use UpvertedFiles instead of raw Info.Files in a few places X-Git-Tag: v1.56.0~62^2 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=026bbe2a6f52b056099caeb865769ee4137cd3dd;p=btrtrc.git Use UpvertedFiles instead of raw Info.Files in a few places --- diff --git a/cmd/torrent/serve.go b/cmd/torrent/serve.go index bdb15594..d37dafaf 100644 --- a/cmd/torrent/serve.go +++ b/cmd/torrent/serve.go @@ -44,7 +44,7 @@ func serve() (cmd bargle.Command) { if err != nil { return fmt.Errorf("building info from path %q: %w", filePath, err) } - for _, fi := range info.Files { + for _, fi := range info.UpvertedFiles() { log.Printf("added %q", fi.Path) } mi := metainfo.MetaInfo{ diff --git a/fs/torrentfs.go b/fs/torrentfs.go index 5e0b75ea..1b7b144e 100644 --- a/fs/torrentfs.go +++ b/fs/torrentfs.go @@ -72,7 +72,7 @@ func isSubPath(parent, child string) bool { func (dn dirNode) ReadDirAll(ctx context.Context) (des []fuse.Dirent, err error) { names := map[string]bool{} - for _, fi := range dn.metadata.Files { + for _, fi := range dn.metadata.UpvertedFiles() { filePathname := strings.Join(fi.Path, "/") if !isSubPath(dn.path, filePathname) { continue