Commit Graph

1346 Commits

Author SHA1 Message Date
Robert Haines 8699e356d4 Improve documentation for `File.glob`.
Closes #338.
2021-06-26 20:04:17 +01:00
Robert Haines a301d68eeb Raise an error if entry names exceed 65,535 characters.
Fixes #247.
2021-06-26 19:21:07 +01:00
Robert Haines 49e313629e Remove the `ZipXError` v1 legacy classes. 2021-06-26 17:39:25 +01:00
Robert Haines e000552deb Raise an error on reading a split archive with `InputStream`.
Fixes #349.
2021-06-26 12:39:08 +01:00
Robert Haines 193507b15a Adjust Layout/LineLength cop to 100 characters.
We'll get the line length down in stages...
2021-06-25 22:31:34 +01:00
Robert Haines de6ec15610 Update Changelog. 2021-06-25 17:54:30 +01:00
Robert Haines 84b3e8c644 Ensure `InputStream` raises `GPFBit3Error` for OSX Archive files.
Fixes #493.
2021-06-25 17:53:18 +01:00
Robert Haines 78565db40c Simplify `InputStream.open_entry`.
Also ensure `@complete_entry` is initialized!
2021-06-25 17:53:18 +01:00
Robert Haines c29297c0b8 Add a test to ensure `InputStream` raises `GPFBit3Error`. 2021-06-25 17:53:18 +01:00
Robert Haines ac053bd787 Improve documentation and error messages for `InputStream`.
Closes #196.
2021-06-25 16:58:01 +01:00
Robert Haines 1183607ea1 Flush buffered `OutputStream` on close.
Fixes #265.
2021-06-23 22:24:44 +01:00
Robert Haines a2a14c2cd2 Fix Style/RedundantRegexpEscape cop. 2021-06-18 16:31:23 +01:00
Robert Haines f1e8c2fc9d Fix Style/StringConcatenation cop. 2021-06-18 16:10:57 +01:00
Robert Haines f66a15a85d Update rubocop config. 2021-06-18 16:00:57 +01:00
Robert Haines 71f2c90b20 Test that a corrupted cdir entry is caught. 2021-06-18 12:08:31 +01:00
Robert Haines 75386f8db6 Remove now redundant `IOizeString` module. 2021-06-18 11:50:07 +01:00
Robert Haines afe1892208 Fix a mis-firing CentralDirectory test.
`test_read_from_truncated_zip_file` was not testing what it thought it
was. It was testing whether we caught an out-of-bounds cdir offset, not
whether we caught a corrupted cdir entry.

This commit embraces the actual behaviour and tests that we catch an
out-of-bounds error for both standard `IO`s and `StringIO`s.
2021-06-18 11:44:58 +01:00
Robert Haines bf3ae2ad76 Improve some entry header tests.
Use `StringIO` instead of the custom `IOizeString` code in the
test_helper.

Also test both versions (class and instance) of the `Entry` APIs.
2021-06-18 11:11:11 +01:00
Robert Haines 750c474610 Update Changelog. 2021-06-12 16:31:50 +01:00
Robert Haines 21ba82c67c Move the split signature to the constants file. 2021-06-12 16:29:25 +01:00
Robert Haines 80382135e5 Tidy up some of the file split code. 2021-06-12 16:29:25 +01:00
Robert Haines bd2f15e4bb Extract the `Zip::File::split` code into its own module.
This code is rarely used and may not even be correct according to the
standard. Also this de-clutters the `File` class.
2021-06-12 16:29:06 +01:00
Robert Haines 7df623fb0e Read EOCD record for Zip64 files.
Means we actually read in the file-level comment now!

Fixes #492.
2021-06-11 23:23:34 +01:00
Robert Haines be1c5b7c03 Turn on FULL_ZIP64_TEST in CI. 2021-06-11 17:28:52 +01:00
Robert Haines 3fbb48de31 Refactor the full 64bit tests. 2021-06-11 17:28:52 +01:00
Robert Haines d8111826bf Remove the now redundant `read_zip_*` methods.
We're unpacking headers in chunks now, using `unpack`.
2021-06-11 13:51:40 +01:00
Robert Haines dc27c99eb1 Refactor unpacking the Zip64 eocd record. 2021-06-11 13:50:09 +01:00
Robert Haines 7e254dc581 Refactor unpacking the eocd record.
The old version used some really obfuscated code to perform what is an
essentially fairly simple job.
2021-06-10 22:44:51 +01:00
Robert Haines cd9a3fcad1 Move all the `read_zip_*` methods out of `Entry`.
They were only ever used in `CentralDirectory` anyway.
2021-06-10 17:29:00 +01:00
Robert Haines c0f20321ae Merge branch 'fix_depreciation_warning' of https://github.com/bbuchalter/rubyzip into bbuchalter-fix_depreciation_warning
* 'fix_depreciation_warning' of https://github.com/bbuchalter/rubyzip:
  Use default ruby behavior for Array.join
  Remove OUTPUT_FIELD_SEPARATOR-related test behaviors
  Set OUTPUT_FIELD_SEPARATOR to nil in test
  Prefer OUTPUT_RECORD_SEPARATOR to $\
  Prefer OUTPUT_FIELD_SEPARATOR to $,
2021-06-07 20:02:15 +01:00
Robert Haines 51c6c10e7a Add a compatibility table to the README.
Fixes #455.
2021-06-06 20:06:59 +01:00
Robert Haines 4fe6bc8983 Update README to remove link to Travis. 2021-06-06 18:11:41 +01:00
Jan-Joost Spanjers 4a01537f32 Fix restore permissons test on Windows 2021-06-06 16:17:22 +01:00
Jan-Joost Spanjers 52bcfc72f9 Revert "REVERT ME: This disables a test fixed by #486"
This reverts commit 6ac2cb207d.
2021-06-06 16:17:22 +01:00
Robert Haines 369056ff30 Update Changelog. 2021-06-06 16:17:22 +01:00
Robert Haines 2410f2889e Restore file timestamps on all platforms.
Was only being done on Unix-type filesystems for some reason. Moved code
so that it is run for all files, whatever the underlying platform.
2021-06-06 16:17:22 +01:00
Robert Haines 3260e4e666 Add some tests to ensure the default behaviour sticks. 2021-06-06 16:17:22 +01:00
Robert Haines a6c6345084 Set restoring permissions and times as the default. 2021-06-06 16:17:22 +01:00
Robert Haines 684b69f330 Move the restore options to the top level.
This will ensure consistency between `File` and `Entry`.
2021-06-06 16:17:22 +01:00
Robert Haines 098bce399a Update Changelog. 2021-06-06 15:45:04 +01:00
Robert Haines a4e51f15fc Use constants instead of literals for some `fstype` calls. 2021-06-06 15:02:49 +01:00
Robert Haines 26b7f98c08 Use octal for more obvious definition of file-modes. 2021-06-06 15:02:49 +01:00
Robert Haines 9d8fc05c43 Refactor `get_entry` in `FileSystem::File(::Stat)`.
Rename it to `find_entry` because that is ultimately what is called on
the underlying zip file. Make `FileSystem::File#find_entry` public as it
need to be called from `FileSystem::File::Stat`, so now we can avoid
`__send__`. Neither class is documented anyway, so no harm done there.
2021-06-06 15:02:49 +01:00
Robert Haines 64a162ced4 Refactor `FileSystem::File::Stat.delegate_to_fs_file`.
Now uses `class_exec` instead of `class_eval`.
2021-06-06 15:02:49 +01:00
Robert Haines 99ecf3638f Remove spurious empty line at start of module. 2021-06-06 15:02:49 +01:00
Robert Haines 7b2e9c7970 Extract `FileSystem::File::Stat` from `FileSystem::File`. 2021-06-06 15:02:49 +01:00
Robert Haines d1329299c3 Extract `FileSystem::File` from the main filesystem file. 2021-06-06 15:02:49 +01:00
Robert Haines a1c9b63e61 Extract `FileSystem::Dir` from the main filesystem file. 2021-06-06 15:02:49 +01:00
Robert Haines 239baef845 Extract `DirectoryIterator` from the main filesystem file. 2021-06-06 15:02:49 +01:00
Robert Haines 204d084fdf Extract `ZipFileNameMapper` from the main filesystem file. 2021-06-06 15:02:49 +01:00