1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-09-15 18:57:04 +00:00

refactor(icon): simplify findIconURLsFromHTMLDocument

- Don't define the queries before possible early returns
- Check for the presence of the href attribute in the queries, instead of later
  on iterating on the selection
- Add two edge-cases to the tests
- Use EachIter instead of Each, if only to avoid the lambda
This commit is contained in:
jvoisin 2025-07-11 00:05:22 +02:00 committed by Frédéric Guillot
parent 57bd384951
commit 0e9da3a090
2 changed files with 16 additions and 17 deletions

View file

@ -115,7 +115,7 @@ func TestParseInvalidImageDataURLWithWrongPrefix(t *testing.T) {
func TestParseDocumentWithWhitespaceIconURL(t *testing.T) {
html := `<link rel="shortcut icon" href="
/static/img/favicon.ico
">`
"><link rel='shortcut icon'><link rel='shortcut icon' href=" ">`
iconURLs, err := findIconURLsFromHTMLDocument(strings.NewReader(html), "text/html")
if err != nil {