Skip to content

Commit

Permalink
skip scraping empty files
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Hernandez committed Sep 1, 2023
1 parent 14cd59c commit 115a5eb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/registry/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,16 @@ func (pm *ProviderMetadata) ScrapeRepo(config *ScrapeConfiguration) error {
return nil
}
r := &Resource{}
// don't scrape if file is empty
filename := filepath.Clean(path)
b, err := os.ReadFile(filename)
if err != nil {
return errors.Wrap(err, "failed to read markdown file")
}
if len(b) == 1 {
fmt.Printf("skipping empty file: %s\n", filename)
return nil
}
if err := r.scrape(path, config); err != nil {
return errors.Wrapf(err, "failed to scrape resource metadata from path: %s", path)
}
Expand Down

0 comments on commit 115a5eb

Please sign in to comment.