fix(archive): handle file open error in list_archive method

This commit is contained in:
ttyS3 2024-09-06 14:40:26 +00:00 committed by João Marcos
parent 08ab63837e
commit bafbd83bd7

View File

@ -182,7 +182,13 @@ pub fn list_archive(
archive_path: &Path,
password: Option<&[u8]>,
) -> impl Iterator<Item = crate::Result<FileInArchive>> {
let reader = fs::File::open(archive_path).unwrap();
let reader = fs::File::open(archive_path);
if let Err(e) = reader {
return vec![Err(Error::IoError {reason:e.to_string()})].into_iter();
}
let reader = reader.unwrap();
let mut files = Vec::new();