in pkg/bundle/bundle_v1_extractor.go [36:63]
func (e *v1Extractor) extractWithTarReader(tarReader *tar.Reader, extractLocation string, fs fs.FileSystem) error {
// crete the Extract location if it doesn't exist
extractLocationErr := fs.MkdirAll(extractLocation, defaultFileMode)
if extractLocationErr != nil {
return extractLocationErr
}
// iterate headers and process each file in the tar
for {
header, err := tarReader.Next()
if err == io.EOF {
// we there are no more headers, we finish
break
} else if err != nil {
return err
}
// we only Extract when they are expected files
if isExpectedFile(header.Name) {
extractErr := newTarExtractor(tarReader).Extract(extractLocation, fs)
if extractErr != nil {
return extractErr
}
}
}
return nil
}