#49: Filter out unprintable characters
This commit is contained in:
parent
8c2be97d3b
commit
d907d5a5a3
4 changed files with 14 additions and 33 deletions
|
@ -135,5 +135,12 @@ fn too_broad(path: &str) -> bool {
|
|||
}
|
||||
|
||||
pub fn usable(path: &str) -> bool {
|
||||
!path.is_empty() && !path.contains("{{") && !path.starts_with("./") && !path.starts_with("../") && !too_broad(path)
|
||||
static UNPRINTABLE: Lazy<Regex> = Lazy::new(|| Regex::new(r"(\p{Cc}|\p{Cf})").unwrap());
|
||||
|
||||
!path.is_empty()
|
||||
&& !path.contains("{{")
|
||||
&& !path.starts_with("./")
|
||||
&& !path.starts_with("../")
|
||||
&& !too_broad(path)
|
||||
&& !UNPRINTABLE.is_match(path)
|
||||
}
|
||||
|
|
Reference in a new issue