Benjamin Richner
cf7ff173b3
merge edition 2018 and other improvements from master
2020-05-21 21:58:38 +02:00
Zachary Dremann
b3c836d9c3
Ensure crc32 checksum is checked only at the end of the reader
...
The caller can pass in an empty slice for reading, which should return
`Ok(0)`, not raise an error about an invalid checksum prematurely
2020-05-15 17:11:49 -04:00
Zachary Dremann
2b50419947
Add some simple crc32 reader tests
2020-05-15 17:10:58 -04:00
Manu Thambi
91c93579f2
Added ZipArchive::file_names() method to return an iterator of all the file names
...
in the archive.
Using ZipArchive::by_index() to obtain a list of files is slow, if the files are
not read, because it creates the decompressor internally before returning ZipFile.
Fixes #122
2020-01-14 09:58:12 -05:00
Mathijs van de Nes
80957e2db9
Merge branch 'tm_mon-bounds-fix' of https://github.com/johannesmaibaum/zip-rs
2020-01-11 13:12:04 +01:00
Manu Thambi
69ad3bd2a4
Enable reading/writing ZIP archive comment.
2020-01-09 11:58:35 -05:00
Mathijs van de Nes
a85e3eb809
Fix error checking tm_mon in time::Tm conversion
...
Fixes #128
2020-01-06 22:27:46 +01:00
Johannes Maibaum
b2a669bd33
Fix bounds check in DateTime::from_time()
...
`::time::Tm.tm_mon` has number range [0, 11], see:
https://docs.rs/time/0.1.42/time/struct.Tm.html#structfield.tm_mon
2020-01-03 10:04:58 +01:00
Johannes Maibaum
120732780f
Add bounds test for DateTime::from_time()
...
Fails for 1980-01-01 00:00:00.
2020-01-03 10:04:05 +01:00
Lachezar Lechev
29517e9a6b
run cargo fix --edition-idioms
and manually fix other things
2019-11-11 09:20:31 +02:00
Lachezar Lechev
99dba6b397
run cargo fix --edition
2019-11-11 08:58:59 +02:00
Benjamin Richner
744bb41b43
Ignore password if file not encrypted. Clean up code structure.
2019-10-20 00:58:07 +02:00
Benjamin Richner
2a5112386c
Remove useless return in ZipCryptoReaderValid::read()
2019-10-19 23:44:20 +02:00
Benjamin Richner
1f87098e57
Enable decryption with file reader by_name()
2019-10-19 23:43:33 +02:00
Benjamin Richner
f9f5029fc1
Added ZipCrypto support for stored and deflated files
2019-10-19 18:59:10 +02:00
Mathijs van de Nes
f9c2c64faa
Merge branch 'flate2' of https://github.com/jonpas/zip-rs
2019-08-14 20:40:00 +02:00
Michael Lamparski
907e13b5b6
impl Default for write::FileOptions
2019-07-22 13:24:34 -04:00
Joel Depooter
cd867ecdc2
Add ZipFile::header_start
...
This function returns the offset of the local zip header for a ZipFile object
2019-07-02 16:27:45 -07:00
jonpas
c30d7c3d10
Remove _ - updated rustc
2019-06-18 12:32:44 +02:00
jonpas
14f77b390a
Use deflate as feature name
2019-06-17 21:36:38 +02:00
jonpas
b171b915f8
Switch to flate2
2019-06-14 15:25:00 +02:00
jonpas
6f9150d3dc
Fix compilation error
2019-06-14 15:02:41 +02:00
Mathijs van de Nes
57c8444d8e
Simplify test code of compression
2019-04-06 17:58:12 +02:00
Mathijs van de Nes
256da313b4
Remove warning
2019-04-06 17:23:57 +02:00
Mathijs van de Nes
2314abc307
Merge pull request #96 from damiencollard/file_and_dir_predicates
...
Add ZipFile::is_dir() and ZipFile::is_file().
2019-04-06 17:07:55 +02:00
Mathijs van de Nes
cdbdc008fc
Allow a Path to be used as a file/directory name
...
Instead of using string directly, also accept a Path object. This moves
the responsibility from using the correct path separator and not using
invalid path components to this library.
2019-04-06 16:30:02 +02:00
unknown
8a24ef994f
Fix bounds check in DateTime::from_time
2019-03-05 21:43:59 -06:00
Damien Collard
b9af51e654
Add ZipFile::is_dir() and ZipFile::is_file().
...
The naming matches that of std::fs::Metadata.
An entry is determined to be a directory based on the presence of
a trailing path separator, i.e. '/' or '\'.
This patch adds a small test zip containing files and directories.
Their names match their type so as to make testing easy.
2019-01-27 15:57:30 +01:00
Mathijs van de Nes
659c9186c6
Remove unused import
2018-12-06 19:55:29 +01:00
Mathijs van de Nes
ad7a0fd4e5
Fix for rust 1.20.0
2018-11-17 12:10:23 +01:00
Mathijs van de Nes
b6e12e9451
Remove TODO
...
Changed my mind, API seems good
2018-11-17 11:53:53 +01:00
Mathijs van de Nes
803a4d7521
Do not allow writing to a directory
2018-11-17 11:53:37 +01:00
Mathijs van de Nes
cfbcd768d3
Fix bug in last_modified_time
2018-11-17 11:30:00 +01:00
Mathijs van de Nes
4fd5c9e509
Update DateTime API
2018-11-17 11:08:41 +01:00
Mathijs van de Nes
f94d4b7a78
Change date api
...
Remove msdos_time dependency, and introduce simplified DateTime object.
This object does bounds checking to see if dates are representable in
msdos.
2018-11-17 10:26:25 +01:00
Sam Rijs
8ae6d81ab9
use crc32fast crate for checksumming
2018-11-14 00:44:34 +11:00
Mathijs van de Nes
4ae1db992c
Merge branch 'add-libflate' of https://github.com/xmclark/zip-rs
2018-11-13 10:33:16 +01:00
Mackenzie Clark
6528ea63d2
use the fully qualified decoder name
2018-11-09 16:20:40 -08:00
Sam Rijs
a9a3fb521e
Defer conversion to time::Tm on read
2018-11-07 00:06:42 +11:00
Sam Rijs
9e8747872b
Defer parsing of local file header
2018-11-06 23:14:23 +11:00
Mackenzie Clark
c05b6c2317
add libflate feature
2018-11-04 10:12:21 -08:00
Mathijs van de Nes
bb38674a14
Add archive_offset after processing extra fields
...
This ensures that the value will still be 0xFFFFFFFF before parsing a
zip64 extra field, and that the correction will also apply after the
parsing.
2018-10-17 11:45:41 +02:00
Mathijs van de Nes
c286a8ba16
Zip64: also support a large header_start
2018-10-17 11:39:15 +02:00
Mathijs van de Nes
a1d579b146
Silence warnings about AsciiExt
...
Some supported rust versions still require this import
2018-10-16 17:47:48 +02:00
Mathijs van de Nes
dbb871245b
Fix parse_extra_field for zip64
...
The specification states that fields are only present when their
corresponding entry in the central directory is set to 0xFFFFFFFF.
2018-10-16 17:44:53 +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
Mathijs van de Nes
b23200d4a1
Append a slash to directory names
...
If a directory name does not end with a slash, append it to it when
writing a zip file. This way we can ensure it is distuinguishable from
an empty file.
2018-08-15 21:54:24 +02:00
Mathijs van de Nes
1c2024c554
Derivce Clone for ZipArchive
2018-06-22 15:47:29 +02:00
Mathijs van de Nes
2fa4111042
Fix an issue parsing zip64 files
...
Offset to the start of central directory may be 0xFFFFFFFF if it is a
Zip64 file. Previously, that value was used when calculating the archive
offset. The value will now be ignored if the Zip64 central directory
could be located.
2018-06-22 15:16:04 +02:00
Johan Andersson
0b222aa958
Remove redundant type specification
2018-06-20 01:38:43 +02:00