From c532d003f31fc56af004e68433a736be3e7bd3fd Mon Sep 17 00:00:00 2001 From: Robert Detjens Date: Sat, 8 Feb 2025 01:10:10 -0800 Subject: [PATCH] Fix returned archive name, actually return assets in build results Signed-off-by: Robert Detjens --- src/builder/artifacts.rs | 3 +-- src/builder/mod.rs | 8 ++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/builder/artifacts.rs b/src/builder/artifacts.rs index 5c37656..24b046c 100644 --- a/src/builder/artifacts.rs +++ b/src/builder/artifacts.rs @@ -176,7 +176,6 @@ async fn extract_rename( async fn extract_archive( chal: &ChallengeConfig, container: &docker::ContainerInfo, - // files: &Vec, files: &[PathBuf], archive_name: &Path, ) -> Result> { @@ -203,7 +202,7 @@ async fn extract_archive( // archive_name already has the chal dir prepended zip_files(archive_name, &copied_files)?; - Ok(vec![chal.directory.join(archive_name)]) + Ok(vec![archive_name.to_path_buf()]) } /// Add multiple local `files` to a zipfile at `zip_name` diff --git a/src/builder/mod.rs b/src/builder/mod.rs index 93ea5a8..1245905 100644 --- a/src/builder/mod.rs +++ b/src/builder/mod.rs @@ -138,7 +138,7 @@ async fn build_challenge( // extract each challenge provide entry // this handles both local files and from build containers - let extracted_files = chal + built.assets = chal .provide .iter() .map(|p| async { @@ -152,7 +152,11 @@ async fn build_challenge( }) }) .try_join_all() - .await?; + .await? + // flatten to single vec of all paths + .into_iter() + .flatten() + .collect_vec(); info!("extracted artifacts: {:?}", built.assets); }