aboutsummaryrefslogtreecommitdiff
path: root/src/zip/file/read.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/zip/file/read.rs')
-rw-r--r--src/zip/file/read.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/zip/file/read.rs b/src/zip/file/read.rs
index d25655e..567fb75 100644
--- a/src/zip/file/read.rs
+++ b/src/zip/file/read.rs
@@ -116,7 +116,9 @@ impl<Io: Read + Seek> Encryption<IoCursor<Io>> {
116 Aes256::new(key.into()), 116 Aes256::new(key.into()),
117 )?) 117 )?)
118 } 118 }
119 EncryptionMethod::Unsupported => return Err(ZipError::UnsupportedEncryptionMethod), 119 EncryptionMethod::Unsupported => {
120 return Err(ZipError::Unsupported("encryption method"))
121 }
120 }) 122 })
121 } 123 }
122} 124}
@@ -141,7 +143,7 @@ impl<Io: Read + Seek> Seek for Encryption<Io> {
141 Self::None(io) => io.seek(pos), 143 Self::None(io) => io.seek(pos),
142 _ => Err(IoError::new( 144 _ => Err(IoError::new(
143 IoErrorKind::Unsupported, 145 IoErrorKind::Unsupported,
144 ZipError::EncryptedDataIsUnseekable, 146 ZipError::UnseekableFile,
145 )), 147 )),
146 } 148 }
147 } 149 }
@@ -182,8 +184,8 @@ impl<Io: Read + Seek> Compression<Io> {
182 } 184 }
183 CompressionMethod::Zstd => Self::Zstd(ZstdDecoder::new(io)?), 185 CompressionMethod::Zstd => Self::Zstd(ZstdDecoder::new(io)?),
184 CompressionMethod::Xz => Self::Xz(XzDecoder::new(io)), 186 CompressionMethod::Xz => Self::Xz(XzDecoder::new(io)),
185 CompressionMethod::Unsupported(id) => { 187 CompressionMethod::Unsupported => {
186 return Err(ZipError::UnsupportedCompressionMethod(id)) 188 return Err(ZipError::Unsupported("compression method"));
187 } 189 }
188 }) 190 })
189 } 191 }
@@ -209,7 +211,7 @@ impl<Io: Read + Seek> Seek for Compression<Io> {
209 Compression::Store(io) => io.seek(pos), 211 Compression::Store(io) => io.seek(pos),
210 _ => Err(IoError::new( 212 _ => Err(IoError::new(
211 IoErrorKind::Unsupported, 213 IoErrorKind::Unsupported,
212 ZipError::CompressedDataIsUnseekable, 214 ZipError::UnseekableFile,
213 )), 215 )),
214 } 216 }
215 } 217 }
@@ -235,7 +237,7 @@ impl<'d, Io: Read + Seek> ZipFileReader<'d, Io> {
235 237
236 let buf = io.read_arr::<30>()?; 238 let buf = io.read_arr::<30>()?;
237 if buf[..4] != FILE_HEADER_SIGNATURE { 239 if buf[..4] != FILE_HEADER_SIGNATURE {
238 return Err(ZipError::InvalidFileHeaderSignature); 240 return Err(ZipError::InvalidSignature("FileHeader"));
239 } 241 }
240 242
241 let cursor = io.seek(SeekFrom::Start( 243 let cursor = io.seek(SeekFrom::Start(