Commit graph

444 commits

Author SHA1 Message Date
Chris Hennick
3b3b63cef5
Fix a flaky test 2023-04-23 15:14:44 -07:00
Chris Hennick
6dc099d128
Fix more formatting issues 2023-04-23 15:12:56 -07:00
Chris Hennick
9330bdb7b7
Don't need Read for shallow copy 2023-04-23 15:09:22 -07:00
Chris Hennick
85689cd2e6
Remove unused #![feature(read_buf)] 2023-04-23 15:05:53 -07:00
Chris Hennick
d3400509bc
Fix formatting issues from cargo fmt 2023-04-23 14:58:10 -07:00
Chris Hennick
7e7483ef5c
Remove unnecessary package qualifiers 2023-04-23 14:52:14 -07:00
Chris Hennick
360a7de003
Fix clippy warning: use write_all instead of write 2023-04-23 14:51:17 -07:00
Chris Hennick
cde5d5ed11
Implement shallow copy from within the file being written 2023-04-23 14:33:10 -07: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