mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-05 02:55:31 +00:00
fix: remove unnecessary clones in zip decryption
This commit is contained in:
parent
309d165606
commit
61868dfb56
@ -45,7 +45,7 @@ where
|
||||
for idx in 0..archive.len() {
|
||||
let mut file = match password {
|
||||
Some(password) => archive
|
||||
.by_index_decrypt(idx, password.to_owned().as_bytes())?
|
||||
.by_index_decrypt(idx, password.as_bytes())?
|
||||
.map_err(|_| zip::result::ZipError::UnsupportedArchive("Password required to decrypt file"))?,
|
||||
None => archive.by_index(idx)?,
|
||||
};
|
||||
@ -127,8 +127,7 @@ where
|
||||
let maybe_file_in_archive = (|| {
|
||||
let zip_result = match password.clone() {
|
||||
Some(password) => archive
|
||||
.by_index_decrypt(idx, password.to_owned().clone().as_bytes())
|
||||
.unwrap()
|
||||
.by_index_decrypt(idx, password.as_bytes()).ok()?
|
||||
.map_err(|_| zip::result::ZipError::UnsupportedArchive("Password required to decrypt file")),
|
||||
None => archive.by_index(idx),
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user