Open opens the named file in the 7-zip archive, using the semantics of [fs.FS.Open]: paths are always slash separated, with no leading / or ../ elements.
(name string)
| 313 | // [fs.FS.Open]: paths are always slash separated, with no leading / or ../ |
| 314 | // elements. |
| 315 | func (z *Reader) Open(name string) (iofs.File, error) { |
| 316 | z.initFileList() |
| 317 | |
| 318 | if !iofs.ValidPath(name) { |
| 319 | return nil, &iofs.PathError{Op: "open", Path: name, Err: iofs.ErrInvalid} |
| 320 | } |
| 321 | |
| 322 | e := z.openLookup(name) |
| 323 | if e == nil { |
| 324 | return nil, &iofs.PathError{Op: "open", Path: name, Err: iofs.ErrNotExist} |
| 325 | } |
| 326 | |
| 327 | if e.isDir { |
| 328 | return &openDir{e, z.openReadDir(name), 0}, nil |
| 329 | } |
| 330 | |
| 331 | rc, err := e.file.Open() |
| 332 | if err != nil { |
| 333 | return nil, err |
| 334 | } |
| 335 | |
| 336 | return rc.(iofs.File), nil //nolint:forcetypeassert |
| 337 | } |
| 338 | |
| 339 | func (z *Reader) folderReader(si *streamsInfo, f int) (*folderReadCloser, uint32, bool, error) { |
| 340 | // Create a SectionReader covering all of the streams data |
nothing calls this directly
no test coverage detected