Skip to content

Commit

Permalink
Exclude rel=dns-prefetch links
Browse files Browse the repository at this point in the history
Resolves #1499
  • Loading branch information
wackget authored Oct 8, 2024
1 parent 18d486d commit b8518f3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lychee-lib/src/extract/html/html5ever.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ impl TokenSink for LinkExtractor {
}
}

// Check and exclude rel=preconnect. Other than prefetch and preload,
// preconnect only does DNS lookups and might not be a link to a resource
// Check and exclude `rel=preconnect` and `rel=dns-prefetch`. Unlike `prefetch` and `preload`,
// `preconnect` and `dns-prefetch` only perform DNS lookups and do not necessarily link to a resource
if let Some(rel) = attrs.iter().find(|attr| &attr.name.local == "rel") {
if rel.value.contains("preconnect") {
if rel.value.contains("preconnect") || rel.value.contains("dns-prefetch") {
return TokenSinkResult::Continue;
}
}
Expand Down

0 comments on commit b8518f3

Please sign in to comment.