Skip to content

Commit 3581afe

Browse files
committed
[PDR-13131][feat(zip)]当采集包含目录压缩的zip文件时,tailx只采集非目录文件
1 parent 38745f6 commit 3581afe

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

reader/extract/reader.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,16 +383,21 @@ func (t *ZIP) next() (err error) {
383383
if t.f != nil {
384384
t.f.Close()
385385
}
386-
if t.idx >= 0 && t.idx < len(t.rd.File) {
386+
for ;t.idx >= 0 && t.idx < len(t.rd.File); t.idx++ {
387387
t.zipf = t.rd.File[t.idx]
388+
if t.zipf.FileInfo().IsDir() {
389+
continue
390+
}
388391
t.f, err = t.zipf.Open()
389392
if err != nil {
390393
return err
391394
}
392395
t.sLock.Lock()
393396
t.source = t.zipf.Name
394397
t.sLock.Unlock()
395-
} else {
398+
break
399+
}
400+
if t.idx >= len(t.rd.File) || t.idx < 0 {
396401
return io.EOF
397402
}
398403
t.idx++

0 commit comments

Comments
 (0)