1pub fn is_safe_path(path: &std::path::Path) -> bool { 2 use std::path::Component; 3 !path.components().any(|c| { 4 matches!( 5 c, 6 Component::ParentDir | Component::RootDir | Component::Prefix(_) 7 ) 8 }) 9}