Skip to content

Commit b43135b

Browse files
committed
[rust] Set permissions before copying extracted files
1 parent fb40ce3 commit b43135b

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

rust/src/files.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,6 @@ pub fn unzip(
170170
let target_path = tmp_path.join(path.clone());
171171
create_parent_path_if_not_exists(target_path.as_path())?;
172172
let mut outfile = File::create(&target_path)?;
173-
io::copy(&mut file, &mut outfile)?;
174-
unzipped_files += 1;
175-
log.trace(format!(
176-
"File extracted to {} ({} bytes)",
177-
target_path.display(),
178-
file.size()
179-
));
180173

181174
// Set permissions in Unix-like systems
182175
#[cfg(unix)]
@@ -187,6 +180,14 @@ pub fn unzip(
187180
fs::set_permissions(&target_path, fs::Permissions::from_mode(mode))?;
188181
}
189182
}
183+
184+
io::copy(&mut file, &mut outfile)?;
185+
unzipped_files += 1;
186+
log.trace(format!(
187+
"File extracted to {} ({} bytes)",
188+
target_path.display(),
189+
file.size()
190+
));
190191
}
191192
}
192193
if unzipped_files == 0 {

0 commit comments

Comments
 (0)