diff --git a/Cargo.toml b/Cargo.toml index 530de85dc..2d0f41c7a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,6 +29,7 @@ dunce = "1.0.0" kuchiki = "*" regex = "*" lazy_static = "*" +percent-encoding = "2.1.0" [dev-dependencies] tempfile = "3.1.0" diff --git a/src/validation/web.rs b/src/validation/web.rs index f9a3a02af..14d507929 100644 --- a/src/validation/web.rs +++ b/src/validation/web.rs @@ -2,6 +2,7 @@ use crate::validation::{CacheEntry, Context, Reason}; use http::HeaderMap; use kuchiki::parse_html; use kuchiki::traits::TendrilSink; +use percent_encoding::percent_decode; use reqwest::{Client, Response, Url}; use std::time::SystemTime; @@ -48,6 +49,7 @@ where } let result = if let Some(fragment) = url.fragment() { + let fragment = percent_decode(fragment.as_bytes()).decode_utf8_lossy(); log::debug!("Checking \"{}\" contains \"{}\"", url, fragment); let response = get(ctx.client(), url.clone(), ctx.url_specific_headers(&url))