-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support both directions in MagicFinder, correctly find first CDFH
- Loading branch information
Showing
3 changed files
with
174 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use std::io; | ||
use zip::ZipArchive; | ||
|
||
#[test] | ||
fn test_prepended_garbage() { | ||
let mut v = vec![0, 1, 2, 3]; | ||
v.extend_from_slice(include_bytes!("../tests/data/extended_timestamp.zip")); | ||
|
||
let mut archive = ZipArchive::new(io::Cursor::new(v)).expect("couldn't open test zip file"); | ||
|
||
assert_eq!(2, archive.len()); | ||
|
||
for file_idx in 0..archive.len() { | ||
let file = archive.by_index(file_idx).unwrap(); | ||
let outpath = file.enclosed_name().unwrap(); | ||
|
||
println!( | ||
"Entry {} has name \"{}\" ({} bytes)", | ||
file_idx, | ||
outpath.display(), | ||
file.size() | ||
); | ||
} | ||
} |