From e398325bb05b7f827f9b1ad9bd02c9373f8e39f0 Mon Sep 17 00:00:00 2001 From: wackget <136205263+wackget@users.noreply.github.com> Date: Sat, 12 Oct 2024 00:37:54 +0100 Subject: [PATCH] Exclude `rel=dns-prefetch` links (#1520) Resolves #1499 --- lychee-lib/src/extract/html/html5ever.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lychee-lib/src/extract/html/html5ever.rs b/lychee-lib/src/extract/html/html5ever.rs index d10ac4e..e1b7a67 100644 --- a/lychee-lib/src/extract/html/html5ever.rs +++ b/lychee-lib/src/extract/html/html5ever.rs @@ -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; } }