Skip to content

Commit 8492ae4

Browse files
committed
Skip invalid zip archives
1 parent 7d8eb93 commit 8492ae4

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/github.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ async fn fetch_artifact(
5454
org: &str,
5555
repo: &str,
5656
artifact: WorkflowListArtifact,
57-
) -> Result<bytes::Bytes> {
57+
) -> Result<(String, bytes::Bytes)> {
5858
println!("downloading artifact {}", artifact.name);
5959

6060
let res = client
6161
.actions()
6262
.download_artifact(org, repo, artifact.id, ArchiveFormat::Zip)
6363
.await?;
6464

65-
Ok(res)
65+
Ok((artifact.name, res))
6666
}
6767

6868
enum UploadSource {
@@ -272,9 +272,15 @@ pub async fn command_fetch_release_distributions(args: &ArgMatches) -> Result<()
272272
let mut install_paths = vec![];
273273

274274
while let Some(res) = buffered.next().await {
275-
let data = res?;
275+
let (name, data) = res?;
276276

277-
let mut za = ZipArchive::new(std::io::Cursor::new(data))?;
277+
let mut za = match ZipArchive::new(std::io::Cursor::new(data)) {
278+
Ok(za) => za,
279+
Err(err) => {
280+
eprintln!("failed to read zip archive {name}: {err}");
281+
continue;
282+
}
283+
};
278284
for i in 0..za.len() {
279285
let mut zf = za.by_index(i)?;
280286

0 commit comments

Comments
 (0)