mirror of
https://github.com/Hopiu/lychee.git
synced 2026-04-06 06:20:58 +00:00
Add more known false positive schema domains (#376)
See https://github.com/lycheeverse/lychee-action/issues/53
This commit is contained in:
parent
e346033a10
commit
69e5d56687
1 changed files with 7 additions and 1 deletions
|
|
@ -12,6 +12,9 @@ use crate::Uri;
|
|||
const FALSE_POSITIVE_PAT: &[&str] = &[
|
||||
r"http://www.w3.org/1999/xhtml",
|
||||
r"http://www.w3.org/2000/svg",
|
||||
r"https://schemas.microsoft.com",
|
||||
r"http://schemas.zune.net",
|
||||
r"http://schemas.openxmlformats.org",
|
||||
];
|
||||
|
||||
#[inline]
|
||||
|
|
@ -20,7 +23,7 @@ const FALSE_POSITIVE_PAT: &[&str] = &[
|
|||
/// default. This behavior can be explicitly overwritten by defining an
|
||||
/// `Include` pattern, which will match on a false positive
|
||||
pub fn is_false_positive(input: &str) -> bool {
|
||||
input == FALSE_POSITIVE_PAT[0]
|
||||
FALSE_POSITIVE_PAT.iter().any(|pat| input.starts_with(pat))
|
||||
}
|
||||
|
||||
/// A generic URI filter
|
||||
|
|
@ -247,6 +250,9 @@ mod test {
|
|||
let filter = Filter::default();
|
||||
|
||||
assert!(filter.is_excluded(&website("http://www.w3.org/1999/xhtml")));
|
||||
assert!(filter.is_excluded(&website(
|
||||
"http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
)));
|
||||
assert!(!filter.is_excluded(&website("https://example.org")));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue