Fail download if download fails (#19990)
Co-Authored-By: Mikayla <mikayla@zed.dev> Release Notes: - Remoting: Fixes a bug where we could cache an HTML error page as a binary Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
parent
7ce131aaf8
commit
3d956ca68b
1 changed files with 6 additions and 0 deletions
|
@ -686,6 +686,12 @@ async fn download_remote_server_binary(
|
||||||
let request_body = AsyncBody::from(serde_json::to_string(&update_request_body)?);
|
let request_body = AsyncBody::from(serde_json::to_string(&update_request_body)?);
|
||||||
|
|
||||||
let mut response = client.get(&release.url, request_body, true).await?;
|
let mut response = client.get(&release.url, request_body, true).await?;
|
||||||
|
if !response.status().is_success() {
|
||||||
|
return Err(anyhow!(
|
||||||
|
"failed to download remote server release: {:?}",
|
||||||
|
response.status()
|
||||||
|
));
|
||||||
|
}
|
||||||
smol::io::copy(response.body_mut(), &mut temp_file).await?;
|
smol::io::copy(response.body_mut(), &mut temp_file).await?;
|
||||||
smol::fs::rename(&temp, &target_path).await?;
|
smol::fs::rename(&temp, &target_path).await?;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue