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:
parent
57bd384951
commit
0e9da3a090
2 changed files with 16 additions and 17 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue