Commit graph

444 commits

Author SHA1 Message Date
anatawa12
065058d30d
feat: support deflate64 compression with deflate64 crate 2023-08-04 21:52:08 +09:00
Marli Frost
21a20584bc publish 0.6.6 with aes 0.8 2023-05-16 07:40:54 +01:00
Plecra
4b8f99c238
Merge pull request #354 from zip-rs/aes-bump
update aes to 0.8
2023-05-16 07:38:26 +01:00
Plecra
b76b259ed0
Merge pull request #350 from aquacash5/redundant-tests
Remove redundant tests
2023-05-08 21:25:44 +01:00
Marli Frost
80b8d1eced publish 0.6.5 2023-05-06 15:50:59 +01:00
Marli Frost
2eeb47ce56 add support for writing files with PKWARE encryption 2023-05-06 15:48:52 +01:00
Marli Frost
7fe65607f3 update aes to 0.8
(hazard): The changelog in aes doesn't indicate any change in behaviour,
and I have assumed the new APIs work identically
2023-02-12 11:17:54 +00:00
Kyle Bloom
1aa3710aff Remove redundant tests 2023-02-02 08:56:19 +00:00
Marli Frost
c4c6ec9e7c fix: clippy 2023-02-01 18:03:03 +00:00
Marli Frost
d06d4b295f refactor: move the new ZipStreamReader API to the unstable module 2023-02-01 17:55:07 +00:00
Marli Frost
1eb491e96e fix: clippy lint 2023-02-01 17:39:10 +00:00
Jiahao XU
e322842bfd Fix clippy warning in stream.rs:85
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:33:35 +00:00
Jiahao XU
f97f017d99 Rm read::stream::test::zip_contents
As streaming mode cannot calculate central_header_start.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:33:35 +00:00
Jiahao XU
89ff32d93b Rm infesible guarantee in ZipStreamVisitor::visit_additional_metadata
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:33:35 +00:00
Jiahao XU
ef1846e121 Rm stream::tests::zip64_with_leading_junk
As in streaming mode, there is no way to ignore the leading junk.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:33:35 +00:00
Jiahao XU
b944bee72d Add unit tests for mod read::streams
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:33:35 +00:00
Jiahao XU
c6fe396b56 Impl ZipStreamFileMetadata::is_{dir, file}
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:33:35 +00:00
Jiahao XU
d858994e1e Add guarantee for ZipStreamVisitor::visit_additional_metadata
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:33:35 +00:00
Jiahao XU
8f7c43c227 Rm unnecessary p.exist() check in ZipStreamReader::extract
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:33:35 +00:00
Jiahao XU
5b6d9557c6 Impl ZipStreamReader::extract
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:33:35 +00:00
Jiahao XU
42e2865ccb derive(Debug) for ZipStreamFileMetadata
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:33:35 +00:00
Jiahao XU
02c3699be2 Impl new mod read::stream
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:33:35 +00:00
Jiahao XU
16753209af Refactor: Extract ZipFileData::unix_mode
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:33:35 +00:00
Jiahao XU
a614d1f226 Refactor: Extract ZipFileData::enclosed_name
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:33:35 +00:00
Jiahao XU
08c2e76705 Fix param order in central_header_to_zip_file_inner
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:31:12 +00:00
Jiahao XU
e99c15471c Mv central header parsing to central_header_to_zip_file
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:31:12 +00:00
Jiahao XU
57440efa16 Refactor: Extract new fn central_header_to_zip_file_inner
that does not require `reader` to implement `io::Seek`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:31:12 +00:00
Marli Frost
0a09253896 docs: clarify how to use the add_directory API
closes #323
2023-02-01 17:23:53 +00:00
Marli Frost
42eabc9e33 fix: update references to old from_time API 2023-02-01 14:01:53 +00:00
Kyle Bloom
ccd20c118e fix: Unused import with time feature 2023-02-01 13:58:15 +00:00
Kyle Bloom
ab2800b4d8 chore: Move use for TryInto to top 2023-02-01 13:58:15 +00:00
Kyle Bloom
c2adaf7ee0 fix: Use try into implementation for from_time 2023-02-01 13:58:15 +00:00
Kyle Bloom
3f770178ec fix: Change error type to unit-like struct 2023-02-01 13:58:15 +00:00
Kyle Bloom
5726a07a76 feat: Move from_time to try_from
Moves from_time function to TryFrom<OffsetDateTime>
2023-02-01 13:58:15 +00:00
Kyle Bloom
9a577d09fb
Merge branch 'zip-rs:master' into fix-clippy-issues 2023-02-01 10:07:13 +00:00
Kyle Bloom
503eda67c3 fix: Clippy should implement trait 2023-01-31 17:36:06 +00:00
Kyle Bloom
03f5009c34 fix: Clippy uninlined format args 2023-01-31 17:29:34 +00:00
Mikael Pettersson
3fc54cf68c feat: Detect insufficient Dir record size
- Per zip spec 4.4.1.4 (https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT)
- If a CentralDirectoryEnd record field cannot hold the
  required data, a ZIP64 record must exist and the
  field will be set to -1(0xFFFF || 0xFFFFFFFF)
- Previously these archives were incorrectly detected as multi-disk
2023-01-30 11:13:01 +01:00
jkasari
7b83591f26 Add units to the size documentation.
The documentation did not list what it meant by "size". I changed it to
specify that it is returning the size in bytes.
2023-01-19 18:55:42 -08:00
Wyatt Herkamp
efd7f934ca Merge remote-tracking branch 'origin/master'
# Conflicts:
#	src/read.rs
2022-10-13 07:53:55 -04:00
Wyatt Herkamp
1c5cd4ffda Fixed new Clippy Warnings 2022-10-13 07:51:02 -04:00
Wyatt Herkamp
d59adf0990 Fixed new Clippy Warnings 2022-10-13 07:44:25 -04:00
Wyatt Herkamp
24caeaac27 Make github ci use 1.59 for time depend and fix two clippy warnings 2022-10-13 07:44:21 -04:00
Wyatt Herkamp
89e84e1032 Fixed new Clippy Warnings 2022-09-27 13:30:55 -04:00
Wyatt Herkamp
13084ef732 Make github ci use 1.59 for time depend and fix two clippy warnings 2022-09-12 18:53:15 -04:00
Jiahao XU
80005fd2e1
Optimize inner of ZipArchive::extract
Rm generics in `inner`

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-20 23:54:04 +10:00
Jiahao XU
6402eb0d22
Avoid dup monomorphization in ZipArchive::extract
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-20 23:50:34 +10:00
Jiahao XU
199796cbbf
Rm unnecessary p.exist() in ZipArchive::extract
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-20 23:48:48 +10:00
Dirk Stolle
e3d8f47708 Fix a few typos 2022-05-01 00:39:24 +02:00
Nick Babcock
03613cb56e Fix capacity overflow on invalid zips reads
Preemptively allocating structures with the number of reported files can
lead to trouble as an invalid zip can still have a valid central
directory end that is fed into a `with_capacity` causing it to overflow.

This commit introduces a heuristic that will use the reported number of
files as long as the number is less than the cde offset.

Benchmarks were unaffected by this change.
2022-04-25 21:01:56 -05:00