Skip to content

Commit 18e49cf

Browse files
committed
fix: prevent directory creation if target already exists
1 parent a609ddc commit 18e49cf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

crates/downloader/src/tarball.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ target: {:?}"#,
8888
let target = path.components().skip(1).collect::<PathBuf>();
8989
let target = target_dir.join(target);
9090

91-
if path.is_dir() {
91+
if path.is_dir() && !target.exists() {
9292
std::fs::create_dir_all(&target)?;
9393
continue;
9494
} else {
@@ -117,7 +117,7 @@ target: {:?}"#,
117117
let target = path.components().skip(1).collect::<PathBuf>();
118118
let target = target_dir.join(target);
119119

120-
if path.is_dir() {
120+
if path.is_dir() && !target.exists() {
121121
std::fs::create_dir_all(&target)?;
122122
continue;
123123
} else {
@@ -146,7 +146,7 @@ target: {:?}"#,
146146
let target = path.components().skip(1).collect::<PathBuf>();
147147
let target = target_dir.join(target);
148148

149-
if file.is_dir() {
149+
if file.is_dir() && !target.exists() {
150150
std::fs::create_dir_all(&target)?;
151151
continue;
152152
}

0 commit comments

Comments
 (0)