diff --git a/crates/nu-engine/src/filesystem/path.rs b/crates/nu-engine/src/filesystem/path.rs index d7d4df8f80..efb0decb33 100644 --- a/crates/nu-engine/src/filesystem/path.rs +++ b/crates/nu-engine/src/filesystem/path.rs @@ -29,7 +29,10 @@ where (absolute, relative) } else { - (relative_to.as_ref().to_path_buf(), path) + ( + relative_to.as_ref().to_path_buf(), + components.iter().collect::(), + ) } }; @@ -91,6 +94,17 @@ mod tests { ); } + #[test] + fn absolutize_with_curdir() { + let relative_to = Path::new("/foo"); + let path = Path::new("./bar/./baz"); + + assert!(!absolutize(relative_to, path) + .to_str() + .unwrap() + .contains(".")); + } + #[test] fn canonicalize_should_succeed() -> io::Result<()> { let relative_to = Path::new("/foo/bar");