@@ -109,6 +109,7 @@ func (a *Archive) openArchive(ctx context.Context, depth int, reader io.Reader,
109
109
switch archive := format .(type ) {
110
110
case archiver.Decompressor :
111
111
info := decompressorInfo {depth : depth , reader : arReader , archiveChan : archiveChan , archiver : archive }
112
+
112
113
return a .handleDecompressor (ctx , info )
113
114
case archiver.Extractor :
114
115
return archive .Extract (context .WithValue (ctx , depthKey , depth + 1 ), reader , nil , a .extractorHandler (archiveChan ))
@@ -142,8 +143,7 @@ func (a *Archive) handleDecompressor(ctx context.Context, info decompressorInfo)
142
143
if err != nil {
143
144
return err
144
145
}
145
- newReader := bytes .NewReader (fileBytes )
146
- return a .openArchive (ctx , info .depth + 1 , newReader , info .archiveChan )
146
+ return a .openArchive (ctx , info .depth + 1 , bytes .NewReader (fileBytes ), info .archiveChan )
147
147
}
148
148
149
149
// IsFiletype returns true if the provided reader is an archive.
@@ -176,13 +176,17 @@ func (a *Archive) extractorHandler(archiveChan chan []byte) func(context.Context
176
176
if err != nil {
177
177
return err
178
178
}
179
+ if common .SkipFile (f .Name ()) {
180
+ logger .V (5 ).Info ("skipping file" , "filename" , f .Name ())
181
+ return nil
182
+ }
183
+
179
184
fileBytes , err := a .ReadToMax (ctx , fReader )
180
185
if err != nil {
181
186
return err
182
187
}
183
- fileContent := bytes .NewReader (fileBytes )
184
188
185
- err = a .openArchive (ctx , depth , fileContent , archiveChan )
189
+ err = a .openArchive (ctx , depth , bytes . NewReader ( fileBytes ) , archiveChan )
186
190
if err != nil {
187
191
return err
188
192
}
0 commit comments