Skip to main content

contained_target

Function contained_target 

Source
pub fn contained_target(root_canon: &Path, target: &Path) -> Result<PathBuf>
Expand description

Verify that the real parent directory of target lies within root_canon, returning the concrete path to write/create.

target itself need not exist, but its parent directory must (create directories first). The parent is canonicalized — following any symlinks — and checked against the canonical root.

§Errors

Returns Error::Containment if the resolved parent escapes root_canon.