Skip to content

Commit

Permalink
fix: use absolute path, fix file issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ctron committed Nov 27, 2024
1 parent c10c3eb commit f554e60
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sbom/sbom-cli/src/cmd/inspect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use bytes::Bytes;
use parking_lot::Mutex;
use reqwest::Url;
use sbom_walker::{discover::DiscoveredSbom, retrieve::RetrievedSbom, validation::ValidatedSbom};
use std::{collections::BTreeMap, sync::Arc, time::SystemTime};
use std::{collections::BTreeMap, path::absolute, sync::Arc, time::SystemTime};
use walker_common::{
cli::{client::ClientArguments, validation::ValidationArguments},
fetcher::Fetcher,
Expand Down Expand Up @@ -69,9 +69,10 @@ impl Inspect {
(fetcher.fetch::<Bytes>(url.clone()).await?, url)
} else {
log::debug!("Fetching local");
let url = Url::from_file_path(source)
let path = absolute(source)?;
let url = Url::from_file_path(&path)
.map_err(|()| anyhow!("Failed to convert file to URL"))?;
(tokio::fs::read(source).await?.into(), url)
(tokio::fs::read(path).await?.into(), url)
};

log::info!("{} bytes of data", data.len());
Expand Down

0 comments on commit f554e60

Please sign in to comment.