isPathSafe

fnbool isPathSafe(string path, bool allowTraversal = false) @safe pure

Check if a path is safe for archive extraction.

Validates that a path does not contain path traversal sequences ("..") or other dangerous patterns that could cause files to be written outside the intended destination directory.

Archive entry names are cross-platform data, so both separator styles are recognized: backslashes are treated as separators and Windows-style roots (drive letters, leading separators) are rejected on every platform.

Parameters

pathThe path to validate.
allowTraversalWhether to allow ".." components.

Returns

true if the path is safe for extraction.