Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions link-inspector/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ static EXCLUDED_HOSTS: phf::Set<&'static str> = phf::phf_set! {
fn check_link(link: &str) -> anyhow::Result<()> {
let url = Url::parse(link)?;
if EXCLUDED_HOSTS.contains(url.host_str().unwrap_or_default()) {
println!("⚠️ Skipping link to excluded host: {link}");
println!("⚠️ Skipping link to excluded host: {}", link);
return Ok(());
}

let response = ureq::get(link).call()?;

if !(200..=299).contains(&response.status()) {
bail!(
"❌ Link \"{link}\" is broken (status code: {})",
"❌ Link \"{}\" is broken (status code: {})",
link,
response.status()
);
}
Expand Down