diff options
Diffstat (limited to 'src/zip/driver.rs')
| -rw-r--r-- | src/zip/driver.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/zip/driver.rs b/src/zip/driver.rs index 0905d9a..87f9c1a 100644 --- a/src/zip/driver.rs +++ b/src/zip/driver.rs | |||
| @@ -3,7 +3,8 @@ use crate::utils::ReadUtils; | |||
| 3 | use crate::zip::cp437::FromCp437; | 3 | use crate::zip::cp437::FromCp437; |
| 4 | use crate::zip::structs::{deserialize, Cdr, Eocdr, Eocdr64, Eocdr64Locator, ExtraHeader}; | 4 | use crate::zip::structs::{deserialize, Cdr, Eocdr, Eocdr64, Eocdr64Locator, ExtraHeader}; |
| 5 | use crate::zip::{ | 5 | use crate::zip::{ |
| 6 | BitFlag, CompressionMethod, ZipError, ZipFileInfo, ZipFileReader, ZipFileWriter, ZipResult, | 6 | BitFlag, CompressionMethod, EncryptionMethod, ZipError, ZipFileInfo, ZipFileReader, |
| 7 | ZipFileWriter, ZipResult, | ||
| 7 | }; | 8 | }; |
| 8 | use chrono::{DateTime, Local, NaiveDate, NaiveDateTime, NaiveTime}; | 9 | use chrono::{DateTime, Local, NaiveDate, NaiveDateTime, NaiveTime}; |
| 9 | use std::collections::HashMap as Map; | 10 | use std::collections::HashMap as Map; |
| @@ -220,6 +221,7 @@ impl<Io: Read + Seek> ArchiveRead for Zip<Io> { | |||
| 220 | indexes.insert(name.clone(), i); | 221 | indexes.insert(name.clone(), i); |
| 221 | files.push(ZipFileInfo::new( | 222 | files.push(ZipFileInfo::new( |
| 222 | CompressionMethod::from_struct_id(cdr.compression_method)?, | 223 | CompressionMethod::from_struct_id(cdr.compression_method)?, |
| 224 | EncryptionMethod::from_bit_flag(bit_flag), | ||
| 223 | bit_flag, | 225 | bit_flag, |
| 224 | mtime, | 226 | mtime, |
| 225 | atime, | 227 | atime, |
| @@ -256,10 +258,15 @@ impl<Io: Read + Seek> ArchiveRead for Zip<Io> { | |||
| 256 | self.files.get(index).ok_or(ZipError::FileNotFound.into()) | 258 | self.files.get(index).ok_or(ZipError::FileNotFound.into()) |
| 257 | } | 259 | } |
| 258 | 260 | ||
| 259 | fn get_file_reader<'d>(&'d mut self, index: usize) -> ZipResult<Self::FileReader<'d>> { | 261 | fn get_file_reader<'d>( |
| 262 | &'d mut self, | ||
| 263 | index: usize, | ||
| 264 | password: Option<&str>, | ||
| 265 | ) -> ZipResult<Self::FileReader<'d>> { | ||
| 260 | Ok(ZipFileReader::new( | 266 | Ok(ZipFileReader::new( |
| 261 | &mut self.io, | 267 | &mut self.io, |
| 262 | self.files.get(index).ok_or(ZipError::FileNotFound)?, | 268 | self.files.get(index).ok_or(ZipError::FileNotFound)?, |
| 269 | password, | ||
| 263 | )?) | 270 | )?) |
| 264 | } | 271 | } |
| 265 | } | 272 | } |
