Skip to main content

safe_archive_relative_path

Function safe_archive_relative_path 

Source
pub fn safe_archive_relative_path(name: &Path) -> Result<PathBuf>
Expand description

Validate an archive entry name and return it as a destination-relative path.

Lexical only (no filesystem access): rejects absolute paths, Windows prefixes, and parent components (..), and collapses . components. Unlike a substring check for .., legitimate names such as v1..2/README.md are accepted. An empty result means the name resolves to the extraction destination itself (e.g. .); callers decide whether to skip or reject that.

ยงErrors

Returns an error when the name contains a component that would escape the extraction destination.