pub fn validate_absolute_path(path: &str) -> Result<()>Expand description
Rejects a path that is not absolute (POSIX, or a Windows drive letter or UNC share) or that
has a .. segment. Both / and \ separate segments, so a
backslash cannot hide a traversal.
use strands::vended_tools::paths::validate_absolute_path;
assert!(validate_absolute_path("/tmp/notes.txt").is_ok());
assert!(validate_absolute_path("notes.txt").is_err());
assert!(validate_absolute_path("/tmp/../etc/passwd").is_err());ยงErrors
When the path is relative, or contains a .. segment.