download to directory not filename (#2777)

This commit is contained in:
Aiden McClelland
2024-11-08 12:38:46 -07:00
committed by GitHub
parent 1c90303914
commit 279c7324c4

View File

@@ -138,9 +138,15 @@ async fn cli_get_os_asset(
..
}: HandlerArgs<CliContext, CliGetOsAssetParams>,
) -> Result<RegistryAsset<Blake3Commitment>, Error> {
let ext = method
.iter()
.last()
.or_else(|| parent_method.iter().last())
.unwrap_or(&"bin");
let res = from_value::<RegistryAsset<Blake3Commitment>>(
ctx.call_remote::<RegistryContext>(
&parent_method.into_iter().chain(method).join("."),
&parent_method.iter().chain(&method).join("."),
json!({
"version": version,
"platform": platform,
@@ -152,6 +158,7 @@ async fn cli_get_os_asset(
res.validate(SIG_CONTEXT, res.all_signers())?;
if let Some(download) = download {
let download = download.join(format!("startos-{version}_{platform}.{ext}"));
let mut file = AtomicFile::new(&download, None::<&Path>)
.await
.with_kind(ErrorKind::Filesystem)?;