Skip to content

Commit

Permalink
fs: Fix bug with ArchiveFS stat method
Browse files Browse the repository at this point in the history
I think this is what @WeidiDeng intended from #354
  • Loading branch information
mholt committed Aug 21, 2024
1 parent c341cc0 commit 743ede3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,8 @@ func (f ArchiveFS) Stat(name string) (fs.FileInfo, error) {
return nil, err
}

if (len(files) == 0 && files[0].NameInArchive == name) || found {
// exactly one or exact file found, test name match to detect implicit dir name https://github.com/mholt/archiver/issues/340
if (len(files) == 1 && files[0].NameInArchive == name) || found {
return files[len(files)-1].FileInfo, nil
}

Expand Down

0 comments on commit 743ede3

Please sign in to comment.