Expand description
Lexical path handling — normalization, and the guard that keeps a staged op inside the root it was applied against.
Purely lexical: nothing here touches the filesystem, so it holds for a path naming something that does not exist yet, and it is the same answer on every backend. Symlinks are consequently not resolved — a link inside the root pointing out of it is not something this can see. A backend that must defend against that has to refuse symlinks itself.
Functions§
- escapes_
root - Whether
path, resolved against a root, would land outside it. - normalize
- Lexically normalize a relative path: drop
.components and foldparent/..pairs. Leading..components (escaping the root) are kept — the caller decides whether that is an error, which is whatescapes_rootis for.