path-absolutize icon indicating copy to clipboard operation
path-absolutize copied to clipboard

absolutize_from panics if the path goes outside of root

Open mmm1379 opened this issue 2 years ago • 1 comments

there is a need for normalizing a relative path, so it can even result in sth like "../a/"

#[test]
#[should_panic]
fn test_path_evaluating_to_outside_of_root_panics() {
    let path = Path::new("..");
    let new_path = path.absolutize_from("");
}

mmm1379 avatar Jul 12 '23 14:07 mmm1379

The path that pass to the absolutize_from function should be absolute.

magiclen avatar Jul 12 '23 14:07 magiclen