Skip to content

Commit 292f345

Browse files
committed
use tar.unpack to unpack artifacts
1 parent 63d3988 commit 292f345

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

src/api.rs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -327,29 +327,7 @@ impl BuildRecall for ApiClient {
327327
.context("Failed to pull the artifact from S3")?;
328328

329329
let mut a = tar::Archive::new(resp);
330-
331-
for entry in a
332-
.entries()
333-
.context("Failed to list entries of tar archive")?
334-
{
335-
let mut file = entry.context("Can't process an entry of tar archive")?;
336-
337-
let mut buf = Vec::new();
338-
file.read_to_end(&mut buf)?;
339-
340-
let path = file
341-
.header()
342-
.path()
343-
.context("Failed to parse path of archived file")?
344-
.clone();
345-
346-
if let Some(parent) = path.parent() {
347-
fs::create_dir_all(parent)
348-
.context(format!("Failed to create directory {:?}", parent))?;
349-
}
350-
fs::write(path.clone(), buf)
351-
.context(format!("Failed to write to file at {:?}", path))?;
352-
}
330+
a.unpack(".")?;
353331

354332
Ok(true)
355333
})

0 commit comments

Comments
 (0)