Skip to content

Commit

Permalink
Support local file:// repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
kpcyrd committed Dec 29, 2021
1 parent 0f0dbfc commit c03808e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ async fn main() -> Result<()> {
.context("Failed to load transparency public key")?
.to_box()?;

if args.url.scheme() == "file" {
let path = args
.url
.to_file_path()
.map_err(|_| anyhow!("Failed to convert file:// url to path"))?;
info!("Copying from file {:?} to {:?}", path, args.output);
let n = fs::copy(path, &args.output).context("Failed to copy from file://")?;
debug!("Copied {} bytes", n);
return Ok(());
}

let client = Rc::new(Client::new(args.proxy.clone())?);
let pkg_client = if args.bypass_proxy_for_pkgs {
Rc::new(Client::new(None)?)
Expand Down

0 comments on commit c03808e

Please sign in to comment.