Path expansion no longer removes trailing slashes (#12662)

This PR changes `nu_path::expand_path_with()` to no longer remove
trailing slashes. It also fixes bugs in the current implementation due
to ineffective tests (Fixes #12602).
This commit is contained in:
YizhePKU
2024-05-02 06:28:54 +08:00
committed by GitHub
parent b22d131279
commit f184a77fe1
9 changed files with 476 additions and 355 deletions

View File

@ -1,7 +1,7 @@
#![no_main]
use libfuzzer_sys::fuzz_target;
use nu_path::{expand_path_with, expand_tilde, expand_to_real_path, trim_trailing_slash};
use nu_path::{expand_path_with, expand_tilde, expand_to_real_path};
fuzz_target!(|data: &[u8]| {
if let Ok(s) = std::str::from_utf8(data) {
@ -10,9 +10,6 @@ fuzz_target!(|data: &[u8]| {
// Fuzzing expand_to_real_path function
let _ = expand_to_real_path(path);
// Fuzzing trim_trailing_slash function
let _ = trim_trailing_slash(s);
// Fuzzing expand_tilde function
let _ = expand_tilde(path);