Untar is called for shred archives that do not exist. (#9565)

automerge
This commit is contained in:
anatoly yakovenko 2020-04-18 08:34:55 -07:00 committed by GitHub
parent addbdcb660
commit 729cb5eec6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -344,7 +344,7 @@ impl Blockstore {
}
fn tar_dir(dir: String, archive: String) -> Result<()> {
let args = ["cfz", &archive, &dir];
let args = ["cfzP", &archive, &dir];
let output = std::process::Command::new("tar").args(&args).output()?;
if !output.status.success() {
warn!(
@ -1263,10 +1263,11 @@ impl Blockstore {
let f = fs::File::open(path);
if f.is_err() {
if let Some(archive) = tgz {
Self::extract_data(archive, shred_path)
} else {
Ok(None)
if Path::new(archive).is_file() {
return Self::extract_data(archive, shred_path);
}
}
Ok(None)
} else {
let mut buf = vec![];
f?.read_to_end(&mut buf)?;