Skip to content

Commit

Permalink
fix(hil): fix a bug with overwriting existing rts file (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKaravaev authored Oct 22, 2024
1 parent eb310b8 commit 00afb2d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions hil/src/download_s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,15 @@ pub async fn download_url(
"{out_path_clone:?} already exists!"
);
}
tmp_file_path
.persist_noclobber(&out_path_clone)
.wrap_err("failed to persist temporary file")
if existing_file_behavior == ExistingFileBehavior::Abort {
tmp_file_path
.persist_noclobber(&out_path_clone)
.wrap_err("failed to persist temporary file")
} else {
tmp_file_path
.persist(&out_path_clone)
.wrap_err("failed to persist temporary file")
}
})
.await
.wrap_err("task panicked")??;
Expand Down

0 comments on commit 00afb2d

Please sign in to comment.