Skip to content

Commit 986b87d

Browse files
authored
1 parent 59e4fd4 commit 986b87d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/views.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,10 @@ impl EncodableCrate {
350350
};
351351

352352
// Match documentation URL host against blocked host array elements
353-
if DOCUMENTATION_BLOCKLIST.contains(&url_host) {
353+
if DOCUMENTATION_BLOCKLIST
354+
.iter()
355+
.any(|blocked| url_host.ends_with(blocked))
356+
{
354357
None
355358
} else {
356359
Some(url)
@@ -897,4 +900,14 @@ mod tests {
897900
None
898901
);
899902
}
903+
904+
#[test]
905+
fn documentation_blocked_subdomain() {
906+
assert_eq!(
907+
EncodableCrate::remove_blocked_documentation_urls(Some(String::from(
908+
"http://www.rust-ci.org/crate/crate-0.1/doc/crate-0.1",
909+
),),),
910+
None
911+
);
912+
}
900913
}

0 commit comments

Comments
 (0)