diff --git a/internal/fs/tarfs/tarfs.go b/internal/fs/tarfs/tarfs.go index 1dddf5ae..b1143eb7 100644 --- a/internal/fs/tarfs/tarfs.go +++ b/internal/fs/tarfs/tarfs.go @@ -111,8 +111,7 @@ func (tfs *TarFS) getEntry(operation string, path string) (*entry, error) { if !fs.ValidPath(path) { return nil, &fs.PathError{Op: operation, Path: path, Err: fs.ErrInvalid} } - key := getEntryKey(path) - entry, ok := tfs.entries[key] + entry, ok := tfs.entries[path] if !ok { return nil, &fs.PathError{Op: operation, Path: path, Err: fs.ErrNotExist} } @@ -146,8 +145,8 @@ func (tfs *TarFS) indexEntries() error { return err } - key := getEntryKey(header.Name) - tfs.entries[key] = &entry{ + cleanPath := path.Clean(header.Name) + tfs.entries[cleanPath] = &entry{ header: header, pos: pos - blockSize, } @@ -155,11 +154,6 @@ func (tfs *TarFS) indexEntries() error { return nil } -// getEntryKey cleans the name and returns a key for the entry. -func getEntryKey(name string) string { - return path.Clean(name) -} - // entryFile represents an entryFile in a tar archive and implements `fs.File`. type entryFile struct { io.Reader