mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-07 12:05:46 +00:00
Clear path before creating a dir
This commit is contained in:
parent
eb9a99fff3
commit
d1d781dded
@ -342,6 +342,10 @@ fn decompress_file(
|
||||
//
|
||||
// Any other Zip decompression done can take up the whole RAM and freeze ouch.
|
||||
if formats.len() == 1 && *formats[0].compression_formats == [Zip] {
|
||||
if utils::clear_path(output_dir, question_policy)?.is_none() {
|
||||
// User doesn't want to overwrite
|
||||
return Ok(());
|
||||
}
|
||||
utils::create_dir_if_non_existent(output_dir)?;
|
||||
let zip_archive = zip::ZipArchive::new(reader)?;
|
||||
let _files = crate::archive::zip::unpack_archive(zip_archive, output_dir, question_policy)?;
|
||||
@ -370,6 +374,10 @@ fn decompress_file(
|
||||
reader = chain_reader_decoder(format, reader)?;
|
||||
}
|
||||
|
||||
if utils::clear_path(&output_path, question_policy)?.is_none() {
|
||||
// User doesn't want to overwrite
|
||||
return Ok(());
|
||||
}
|
||||
utils::create_dir_if_non_existent(output_dir)?;
|
||||
|
||||
let files_unpacked;
|
||||
|
Loading…
x
Reference in New Issue
Block a user