isPathSafe
fn
bool isPathSafe(string path, bool allowTraversal = false) @safe pureCheck 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
path | The path to validate. |
allowTraversal | Whether to allow ".." components. |
Returns
true if the path is safe for extraction.