Print the entry type as well when checking archive (#13312) (#13313)

(cherry picked from commit bc7133d752)

Co-authored-by: Ryo Onodera <ryoqun@gmail.com>
This commit is contained in:
mergify[bot]
2020-10-30 17:46:02 +00:00
committed by GitHub
parent 74bfb00959
commit f59c70a836

View File

@ -103,8 +103,9 @@ where
let parts: Vec<_> = parts.map(|p| p.unwrap()).collect();
if !entry_checker(parts.as_slice(), entry.header().entry_type()) {
return Err(UnpackError::Archive(format!(
"extra entry found: {:?}",
path_str
"extra entry found: {:?} {:?}",
path_str,
entry.header().entry_type(),
)));
}
total_size = checked_total_size_sum(total_size, entry.header().size()?, limit_size)?;
@ -451,7 +452,7 @@ mod tests {
let mut archive = Builder::new(Vec::new());
archive.append(&header, data).unwrap();
let result = finalize_and_unpack_snapshot(archive);
assert_matches!(result, Err(UnpackError::Archive(ref message)) if message == "extra entry found: \"foo\"");
assert_matches!(result, Err(UnpackError::Archive(ref message)) if message == "extra entry found: \"foo\" Regular");
}
#[test]