Commit graph

76 commits

Author SHA1 Message Date
Chris Hennick
267ab432cf
chore: partial revert - only &str has chars(), but Box<str> should auto-deref 2024-05-15 16:51:12 -07:00
Chris Hennick
d78f127039
chore: contains_key needs a Box<str>, so generify is_dir to accept one 2024-05-15 16:49:05 -07:00
Chris Hennick
b7ac989013
refactor: is_dir only needs to look at the filename 2024-05-15 16:44:59 -07:00
Chris Hennick
bd473ef75b
perf: Use boxed slice for archive comment, since it can't be concatenated 2024-05-08 15:36:12 -07:00
Chris Hennick
eb063ad432
perf: Optimize for the fact that false signatures can't overlap with real ones 2024-05-08 10:59:32 -07:00
Chris Hennick
e1ef3fc65c
fix: file paths shouldn't start with slashes (#102) 2024-05-06 10:52:52 -07:00
Chris Hennick
52375437dc
fix: Process ZIP files with up to a 65,978-byte comment (https://github.com/zip-rs/zip-old/issues/183) 2024-05-05 19:48:32 -07:00
Chris Hennick
1b2c42b199
style: cargo fmt --all 2024-05-03 15:18:31 -07:00
Chris Hennick
74e76a94ca
chore: Refactor: can short-circuit handling of paths that start with MAIN_SEPARATOR, no matter what MAIN_SEPARATOR is 2024-05-03 15:01:43 -07:00
Chris Hennick
2adbbccb82
perf: Quick filter for paths that contain "/../" or "/./" or start with "./" or "../" 2024-05-03 14:59:35 -07:00
Chris Hennick
0fe12b2ec9
chore: Bug fix: non-canonical path detection when MAIN_SEPARATOR is not slash or occurs twice in a row 2024-05-03 14:34:05 -07:00
Chris Hennick
5cd448802f
chore: Bug fix: must recreate if . or .. is a path element 2024-05-03 14:31:32 -07:00
Chris Hennick
001967186a
perf: Fast handling for separator-free paths 2024-05-03 14:28:14 -07:00
Chris Hennick
6184232e19
perf: Speed up logic if main separator isn't '/' 2024-05-03 14:11:03 -07:00
Chris Hennick
22e8fdbf58
chore: Bug fix 2024-05-03 14:06:48 -07:00
Chris Hennick
753eedb3a7
perf: Drop normalized_components slightly sooner when not using it 2024-05-03 14:06:29 -07:00
Chris Hennick
efbea6f747
perf: Speed up path_to_string in cases where the path is already in the proper format 2024-05-03 14:05:39 -07:00
Chris Hennick
84ae5fc157
refactor: Remove byteorder dependency (#83) 2024-05-02 17:50:27 -07:00
Chris Hennick
42972297f1
fix: Rare bug where find_and_parse would give up prematurely on detecting a false end-of-CDR header 2024-04-29 13:18:17 -07:00
Chris Hennick
e412d8b6df
Restore support for Path and fix handling of ".." 2024-04-20 14:05:11 -07:00
Chris Hennick
5e03f43f9a Fix failing tests other than deflate64 bug 25 2024-03-07 15:16:04 -08:00
Chris Hennick
2407ef95c6
Fixes and refactors for no-features build 2023-05-30 18:17:59 -07:00
Chris Hennick
dc351196e2
Bug fix: don't allow writing files with certain ZIP64 magic strings in their names 2023-05-11 18:52:41 -07:00
Chris Hennick
ad26a3f7f9
Bug fix 2023-05-11 09:39:18 -07:00
Chris Hennick
2ad4c20681
Reformat and fix Clippy warning 2023-05-11 09:35:12 -07:00
Chris Hennick
8c6816fb33
Bug fixes: file can't be ZIP64 if CDR start is after CDR end 2023-05-11 09:33:06 -07: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
Wyatt Herkamp
1c5cd4ffda Fixed new Clippy Warnings 2022-10-13 07:51:02 -04:00
Alexander Zaitsev
77294fd3ce
Revert "Merge pull request #290 from aweinstock314/more-spec-structs"
This reverts commit a1da6860ea, reversing
changes made to 574bb3df17.
2022-03-26 14:13:50 +03:00
Avi Weinstock
fc1007a5a4 Add round-trip serialization tests for zip::spec types. 2022-03-25 14:34:01 -04:00
Avi Weinstock
993cbcdc5c Add zip::spec::{CentralDirectoryHeader, DataDescriptor, LocalFileHeader}, and partially integrate them into zip::{read, write}. 2022-03-25 14:10:10 -04:00
Rouven Spreckels
00c1199dbe Use ZIP64_BYTES_THR and ZIP64_ENTRY_THR. 2022-03-25 16:01:56 +01:00
Rouven Spreckels
d53c8bdf07 Merge branch 'master' into support-extra-field 2020-11-16 11:57:08 +01:00
Rouven Spreckels
9397773a32 Add ZIP64 write support. 2020-10-03 11:05:23 +02:00
Davide Romanini
b91f48a224 fix fmt 2020-08-13 15:53:38 +02:00
Davide Romanini
5c4f0906f8 allow for garbage after comment data 2020-08-13 13:02:53 +02:00
Marli Frost
9ed6904383
refactor: replace the podio crate with byteorder 2020-06-16 18:59:13 +01:00
Ryan Levick
31b4b5c842 Address clippy issues 2020-06-15 11:11:17 +02:00
Ryan Levick
ebb07348ee Run cargo fmt 2020-06-15 10:44:39 +02:00
Lachezar Lechev
99dba6b397
run cargo fix --edition 2019-11-11 08:58:59 +02:00
Benedikt Rascher-Friesenhausen
804cfea51c Replace try! macros with ? operator calls
The `?` operator exists since Rust version 1.13.0 and has since become the
standard and recommended variant over the `try!` macro (see
https://doc.rust-lang.org/std/macro.try.html where it is explicitly mentioned to
use the `?` operator instead of the `try!` macro).

I think it is especially useful to replace the `try!` usages throughout the
examples (since new users might not be familiar with the `try!` macro at all).
2018-10-02 23:12:35 +02:00
Robin Syihab
c99d7c2758
Handle invalid zip header 2017-12-04 01:19:44 +07:00
Peter Williams
4a297c32a8 Implement support for reading ZIP64 central-directory-end records
This provides only very basic ZIP64 support, but it allows us to properly read
archives with more than 65535 files, so long as none of the individual files
need ZIP64 support to be read.
2017-08-12 14:42:32 -04:00
Peter Williams
89f33c9348 Use u64's for internal file offsets.
These are better aligned with Rust's APIs, and lay the groundwork for more
convenient support of Zip64 files.
2017-08-12 14:42:32 -04:00
Mathijs van de Nes
240e1d469d Corrected some static -> const 2017-04-28 10:31:12 +02:00
Stephen M. Coakley
fc746a09db
Handle data prepended to the zip 2017-04-08 03:04:18 -05:00
Mathijs van de Nes
c97d6ed760 Use read_exact from ReadPodExt explicitly
The newely added read_exact from std::..::Read has an incompatible signature
and is not yet stabilized. This ensures that the crate will work on stable and
nightly.
2015-09-02 11:52:30 +02:00
Mathijs van de Nes
726f8133f5 Do not use step_by 2015-04-03 14:56:00 +02:00
Mathijs van de Nes
c185c0cd38 Replace usage of range{,_step}_inclusive 2015-03-31 09:54:09 +02:00
Mathijs van de Nes
132530cb41 Remove some as_slice calls 2015-03-16 10:15:46 +01:00