Skip to content

Commit ef27537

Browse files
committed
🐛 Fix Windows drive path extraction test
1 parent 3518754 commit ef27537

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

cli/tests/cli/stdio/path_traversal.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ use std::fs;
55
use std::io::Write;
66
use std::path::{Path, PathBuf};
77

8+
fn sorted_entry_names(dir: &Path) -> Vec<String> {
9+
let mut names = fs::read_dir(dir)
10+
.unwrap()
11+
.map(|entry| entry.unwrap().file_name().into_string().unwrap())
12+
.collect::<Vec<_>>();
13+
names.sort();
14+
names
15+
}
16+
817
fn build_archive_with_file(archive_path: &Path, file_name: &str, file_content: &[u8]) {
918
if let Some(parent) = archive_path.parent() {
1019
fs::create_dir_all(parent).unwrap();
@@ -566,7 +575,7 @@ fn stdio_extract_rewrites_windows_drive_prefixed_entry_name() {
566575
.success();
567576

568577
assert!(out_dir.join("file04").exists());
569-
assert!(!out_dir.join("c:").exists());
578+
assert_eq!(sorted_entry_names(&out_dir), vec!["file04"]);
570579
}
571580

572581
/// Precondition: Archive contains a file whose entry name uses a Windows UNC API prefix.

0 commit comments

Comments
 (0)