Skip to content

Commit

Permalink
chore: Change HTML link search to use an iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Nov 13, 2024
1 parent 1cc49c8 commit 326eef5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/pattern/html.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ func FindHrefPatterns(resp *http.Response) ([]string, error) {
}

var matches []string
doc.Find("a").Each(func(_ int, s *goquery.Selection) {
for _, s := range doc.Find("a").EachIter() {
if href, found := s.Attr("href"); found {
if slices.Contains(Extensions(), path.Ext(href)) {
matches = append(matches, href)
}
}
})
}

slices.Sort(matches)
slices.Reverse(matches) // Reverse so that .rle comes before .cells
Expand Down

0 comments on commit 326eef5

Please sign in to comment.