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

This commit is contained in:
ttyS3 2024-09-06 14:40:26 +00:00
parent fb4d1d2f8a
commit 5f11600588
No known key found for this signature in database
GPG Key ID: A83C6C687C9E7888

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();