Skip to content

Commit

Permalink
Call FileRequired outside runExtract
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 697980760
  • Loading branch information
vpasdf authored and copybara-github committed Nov 19, 2024
1 parent 622499a commit c53a552
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions extractor/filesystem/extractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,9 @@ func (wc *walkContext) handleFile(path string, d fs.DirEntry, fserr error) error
}

for _, ex := range wc.extractors {
wc.runExtractor(ex, path, fileinfo)
if ex.FileRequired(path, fileinfo) {
wc.runExtractor(ex, path)
}
}
return nil
}
Expand All @@ -318,12 +320,7 @@ func (wc *walkContext) shouldSkipDir(path string) bool {
return false
}

func (wc *walkContext) runExtractor(ex Extractor, path string, fileinfo fs.FileInfo) {
required := ex.FileRequired(path, fileinfo)
if !required {
return
}

func (wc *walkContext) runExtractor(ex Extractor, path string) {
rc, err := wc.fs.Open(path)
if err != nil {
addErrToMap(wc.errors, ex.Name(), fmt.Errorf("Open(%s): %v", path, err))
Expand Down

0 comments on commit c53a552

Please sign in to comment.