use std::path::Path;
#[must_use]
pub fn is_safe_path(path: &Path) -> bool {
for component in path.components() {
if let std::path::Component::ParentDir = component {
return false;
}
}
if let Some(path_str) = path.to_str() {
if path_str.contains("/../") || path_str.contains("..\\") {
return false;
}
}
true
}