Skip to content

Commit 39a94fd

Browse files
committed
fs: Trim leading slash (fix #31)
1 parent 1ffedff commit 39a94fd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ func (f *ArchiveFS) ReadDir(name string) ([]fs.DirEntry, error) {
663663
// one component remains -- then loop again to make sure it's not a duplicate
664664
// (start without the base, since we know the full filename is an actual entry
665665
// in the archive, we don't need to create an implicit directory entry for it)
666-
startingPath := path.Dir(file.NameInArchive)
666+
startingPath := strings.TrimPrefix(path.Dir(file.NameInArchive), "/") // see issue #31
667667
for dir, base := path.Dir(startingPath), path.Base(startingPath); base != "."; dir, base = path.Dir(dir), path.Base(dir) {
668668
if err := ctx.Err(); err != nil {
669669
return err

0 commit comments

Comments
 (0)