Removes any .. traversal segments from a relative path and calls warn
if any were stripped. Normal .. that cancel out within the path (e.g.
foo/../bar → bar) are collapsed but never allowed to escape the root.
Both / and `` are treated as separators for cross-platform safety.
Parameters
input: string
The relative path to sanitize.
warn: (msg:string)=>void
Called with a human-readable warning when traversal segments are removed.
Returns string
The sanitized path (may be an empty string if all segments were traversal).
Removes any
..traversal segments from a relative path and callswarnif any were stripped. Normal..that cancel out within the path (e.g.foo/../bar→bar) are collapsed but never allowed to escape the root. Both/and `` are treated as separators for cross-platform safety.