Skip to content

Commit

Permalink
feat: decompress files before sending
Browse files Browse the repository at this point in the history
  • Loading branch information
dejanb authored and ctron committed Jul 29, 2024
1 parent f018d47 commit d114ad9
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions sbom/sbom-cli/src/cmd/scoop.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
use anyhow::anyhow;
use std::path::{Path, PathBuf};
use walker_common::{cli::client::ClientArguments, progress::Progress, scoop::ScooperBuilder};
use walker_common::{
cli::client::ClientArguments, compression::decompress, progress::Progress,
scoop::ScooperBuilder,
};
use walker_extras::visitors::{SendArguments, SendVisitor};

/// Walk a local directory (or single file) and send the files to a target without any validation.
Expand Down Expand Up @@ -54,8 +58,12 @@ impl Scoop {
let send = send.clone();
Box::pin(async move {
let data = tokio::fs::read(&path).await?;
send.send_advisory(&path.to_string_lossy(), data.into())
.await?;
let name = path
.to_str()
.ok_or_else(|| anyhow!("Invalid UTF-8 sequence in path"))?;
let data = decompress(data.into(), name)?;

send.send_advisory(&path.to_string_lossy(), data).await?;

Ok(())
})
Expand Down

0 comments on commit d114ad9

Please sign in to comment.