Commit Graph

303 Commits

Author SHA1 Message Date
Shigeaki Matsumura c70e5836c7 support traditional encryption 2015-01-01 11:09:17 +09:00
Max Cantor 7c7d786f02 Be smarter about handling buffer file modes. 2014-12-17 16:16:02 -05:00
lobashov 7498e8a9d3 add warn_invalid_date option 2014-12-01 18:39:29 +03:00
Nikolay Petrachkov 5a4d1ba52a Use tr instead of gsub 2014-10-22 16:37:21 +02:00
Henry Yang a7a11e33bd NTFS Extra Field (0x000a) support 2014-09-11 23:04:23 -07:00
James Williams 3b639b6c62 prevent tempfile path from being unlinked by garbage collection 2014-08-29 08:31:56 -06:00
Jason King cf0a5fe386 `Zip.sort_entries` working for zip output 2014-07-24 11:39:37 -07:00
Alexander Simonov d460b81745 Fix #171 2014-07-23 12:59:29 +03:00
Alexander Simonov 2ef328b11b Version bump 2014-07-02 18:17:00 +03:00
Alexander Simonov 2fcdc3a3ea Revert "Return created zip file from Zip::File.open when supplied a block"
This reverts commit e3029d0b10.
2014-07-02 18:15:54 +03:00
Alexander Simonov 2cd56671fc Version bump 2014-07-02 14:11:04 +03:00
Alexander Simonov 62e0a87e49 Merge pull request #166 from layerssss/master
treat empty file as non-exists
2014-07-02 14:07:52 +03:00
Alexander Simonov a989e8c145 Revert "Speed up Deflater sysread speed when number_of_bytes is small and @output_buffer is large"
This reverts commit a800987a52.
2014-07-02 14:05:13 +03:00
Michael Yin fe1d4ade49 treat empty file as non-exists 2014-07-02 12:46:44 +08:00
Alexander Simonov 09011eca6b Merge pull request #141 from zacstewart/master
Add InputStream#ungetc
2014-06-21 17:48:49 +03:00
Tyler Pickett e3029d0b10 Return created zip file from Zip::File.open when supplied a block
This change is to match ruby zip’s behavior to core’s IO.open when
supplied a block.
2014-06-17 10:08:26 -06:00
Alexander Simonov 6b77562d32 Version bump 2014-05-30 20:12:33 +03:00
Mehmet Celik b5c5b6803e Zip::Entry::DEFLATED was forced on every file 2014-04-23 08:42:09 +02:00
mrloop 9eb35ca0c4 Don't send empty string to stream
Unneeded method call removed.
This was causing an issue in rails 4 and zipline
https://github.com/fringd/zipline/pull/10
2014-04-17 13:23:12 +01:00
Alexander Simonov 3ab98483c9 Merge pull request #154 from orien/exception_naming
Alias for legacy error names
2014-04-11 10:03:31 +03:00
Orien Madgwick 9d4292007c alias error names
Ensure we maintain the v1 interface
2014-04-11 08:32:17 +10:00
Alexander Simonov 47ef890de6 Version bump 2014-04-06 18:54:23 +03:00
Orien Madgwick 34f5025d76 default arg for write_buffer
Adding the io parameter to OutputStream::write_buffer breaks backward
compatibility with v1.1.0. Adding a default value reinstates backward
compatibility.
2014-04-06 23:45:19 +10:00
Ian Young 37ed325783 Clean up tempfiles from output stream, fixes #57 2014-04-04 14:32:11 -07:00
Alexander Simonov 527137db5f Version bump 2014-03-18 15:10:31 +02:00
Alexander Simonov f7949596eb Fix #143 2014-03-18 15:09:50 +02:00
Alexander Simonov 57482232da Version bump 2014-03-16 19:29:15 +02:00
Jeremy Stanley b0b46a5b37 only write zip64 central directory if zip64 support enabled 2014-03-13 10:48:04 -06:00
Jeremy Stanley 9e144061b9 fix modifying existing zipfile with zip64 enabled
The local header size computed from the central directory entry
is incorrect due to the Zip64Placeholder in the local entry.
This caused us to seek to the wrong location when copying an
unchanged compressed data stream.

(The same problem could occur when modifying any zip file where
the local header and central directory header contain different
variable-sized fields, so it's a good idea not to trust the CD
to tell us the local header size in any case.)
2014-03-12 15:57:52 -06:00
Zac Stewart 192f910992 Use string concatenation instead of String#prepend
For < Ruby 1.9.3 compatibility
2014-03-12 11:52:12 -04:00
Zac Stewart 96377f72de Add InputStream#ungetc
Works like IO#ungetc
2014-03-11 21:19:24 -04:00
Alexander Simonov 2697c7ea4f Fix #138 2014-03-09 20:38:24 +02:00
Alexander Simonov 34437e77b8 Fix for #125 2014-03-01 12:17:22 +02:00
Alexander Simonov 81c4c4face Fix #135 2014-03-01 00:31:10 +02:00
Alexander Simonov 09ac194540 Merge pull request #130 from srawlins/less-allocations-writing-a-zipfile
Allocate less Arrays and Strings when writing a zip
2014-02-07 09:05:34 +02:00
Sam Rawlins a37e13c6f0 File.exists? -> File.exist? 2014-02-06 15:00:38 -08:00
Henry Yang a800987a52 Speed up Deflater sysread speed when number_of_bytes is small and @output_buffer is large 2014-02-04 10:56:56 -08:00
Sam Rawlins a68a36c759 Allocate less Arrays and Strings when writing a zip 2014-02-03 12:15:08 -08:00
Alexander Simonov ec81c30382 Fix for #126 and #127 2014-01-24 11:37:38 +02:00
René Sprotte 471aa1599e Add config to set the default compression level. 2014-01-20 14:38:22 +01:00
Alexander Simonov 52efd5cd61 Fix tests. Fix duping StringIO for writing 2014-01-19 14:06:54 +02:00
Alexander Simonov c7f0b17abf Real fix for #119 2014-01-19 13:45:58 +02:00
Alexander Simonov 18506c6345 Fix #119 calling 'path' on not IO objects 2014-01-06 20:29:39 +02:00
Jim Ryan 0f8ce2cbb8 Make File.open_buffer support Tempfiles 2013-12-02 18:57:42 -05:00
Alexander Simonov 3917dedbb5 Version bump 2013-11-01 16:36:25 +02:00
Alexander Simonov 94b29aba5d Fix #106 Set options about restoring ownerships, permissions and times. restore permissions enabled by default. 2013-10-27 16:30:48 +02:00
Alexander Simonov cb6e628fb2 Fix #28 and #103 2013-10-20 23:09:52 +03:00
Alexander Simonov 9c25518761 Merge pull request #101 from ProGNOMmers/issue_100
Add entry arguments to Zip::File#get_output_stream. Fixes rubyzip/rubyzip#100
2013-10-19 12:35:09 -07:00
Alexander Simonov 569d0b7078 Fix #102 recover file permissions if zip file was exist 2013-10-19 22:05:18 +03:00
Maurizio De Santis bc512d7061 Add missing Zip::Entry arguments to Zip::File#get_output_stream. Fixes rubyzip/rubyzip#100 2013-10-11 11:40:44 +02:00
Alexander Simonov d1aba72c03 Merge pull request #99 from jstanley0/master
Add read/write support for zip64 extensions
2013-09-27 23:41:56 -07:00
Jeremy Stanley b87c95cc7e fix string encoding of zip64 header ids for ruby 2.0 2013-09-27 21:45:08 -06:00
Jeremy Stanley af165f5cbd Add read/write support for zip64 extensions
This commit adds the capability of creating archives larger than
4GB via zip64 extensions. It also fixes bugs reading archives of
this size (specifically, the 64-bit offset of the local file
header was not being read from the central directory entry).

To maximize compatibility, zip64 extensions are used only when
required. Unfortunately, at the time we write a local file header,
we don't know the size of the file and thus whether a Zip64
Extended Information Extra Field will be required. Therefore
this commit writes a 'placeholder' extra field to reserve space
for the zip64 entry, which will be written if necessary when
we update the local entry with the final sizes and CRC. I use
the signature "\x99\x99" for this field, following the example
of DotNetZip which does the same.

This commit also adds a rake task, zip64_full_test, which
fully tests zip64 by actually creating and verifying a 4GB zip
file. Please note, however, that this test requires UnZip
version 6.00 or newer, which may not be supplied by your OS.
This test doesn't run along with the main unit tests because
it takes a few minutes to complete.
2013-09-27 20:41:00 -06:00
Alexander Simonov 0402911595 Better jRuby support 2013-09-25 21:02:02 +03:00
Alfredo Amatriain fc86984e3c Fixed rdoc comments in filesystem.rb to account for API changes in Rubyzip 1.0.0 2013-09-25 11:40:35 +02:00
Krishna Dole 8d3258eebf Calling #read(number_of_bytes) on a Zip::InputStream should return nil at EOF.
Previously it would return an empty string the first time, then raise on subsequent calls.
2013-09-24 15:29:19 -07:00
Alexander Simonov 2bd6ebea11 JRuby support 2013-09-17 20:34:19 +03:00
Nick Markwell d7091a0271 Typo fix: io.is_a() -> io.is_a?() 2013-09-06 12:20:06 -04:00
Nick Markwell 9f6bc1e2e9 Fixed conditional in Zip::File.open_buffer()
It required it to be be both an IO _and_ a String, which isn't exactly possible.
2013-09-06 12:06:19 -04:00
Alexander Simonov 5f2411955a Fix tests for 1.9.2 2013-08-30 00:22:19 +03:00
Alexander Simonov 73d9e1c8a0 StingIO support #47 #18 2013-08-29 23:50:12 +03:00
Alexander Simonov 72d20297fc Version bump 2013-08-29 10:46:39 +03:00
Alexander Simonov 609de2ff48 Zip64 read-only support. Fix #81 2013-08-26 23:26:14 +03:00
Alexander Simonov 8b92e40227 Version bump 2013-08-22 00:39:52 +03:00
Alexander Simonov 317fdd0d04 Add posibility to set Language encoding flag. Changed way to set settings. 2013-08-15 01:00:27 +03:00
Jason King 8d912fb5de Unset @create when zip exists, fixes #86 2013-07-31 17:31:07 -07:00
Alexander Simonov 51fb507e2a Split functions small cleanup 2013-07-01 00:11:45 +03:00
Alexander Simonov 531003c44f Remove unneeded monkey patch 2013-06-30 23:57:06 +03:00
Alexander Simonov 20d79feb99 Refactor ::Zip::Entry and ::Zip::ExtraField 2013-06-30 23:52:48 +03:00
Alexander Simonov b0f41a55f9 Refactoring of split method 2013-06-03 13:36:45 +03:00
Alexander Simonov 61ce5dbc5f Refactoring part #2
Rubyzip interface was changed!
2013-06-03 10:56:24 +03:00
Alexander Simonov 974f5675c2 Code refactoring start 2013-06-02 21:33:03 +03:00
Alexander Simonov ce2c3ede73 Fix merge 2013-04-13 13:26:20 +03:00
Alexander Simonov 85e6468180 Merge pull request #75 from hbakhtiyor/split-archive-feature
Split archive feature
2013-04-13 01:58:23 -07:00
Alexander Simonov 69f5d65cf2 Merge pull request #77 from kachick/improve-remove_warnings2
Remove some interpreter warnings
2013-04-13 01:54:42 -07:00
Abd ar-Rahman Hamidi 5604881648 Add ZipFile.split method for spliting an archive into parts with chunk size. With samples and test cases 2013-04-07 18:29:33 +05:00
Kenichi Kamiya 6d5fc4144b Fix typo 2013-04-03 23:50:54 +09:00
Kenichi Kamiya 00c104c567 Rename unused variable
This commit removes below interpreter warning.

* warning: assigned but unused variable
2013-04-03 23:46:41 +09:00
Alexander Simonov 66f0c0fafe Merge pull request #65 from marcuserronius/preserve-order
preserves order of zipfile entries
2013-02-07 00:55:28 -08:00
Alexander Simonov fbafce3328 Merge pull request #64 from rap-kasta/master
Averting of compression method override
2013-02-07 00:53:55 -08:00
Alexander Simonov 9f46091456 Merge pull request #67 from JustinLove/getslimit
support gets-with-limit from ruby 1.9
2013-02-07 00:48:38 -08:00
Alexander Simonov e519cc7f61 Merge pull request #68 from Wolfer/patch-1
use Object::File
2013-02-07 00:48:04 -08:00
dismory 4403cc089e Using `FileUtils.mkdir_p` for intermediate directories as required 2013-01-09 17:52:57 +08:00
Serg F 23a63f6786 use Object::File
may be run Zip::File and conflict with other zip library.
2012-12-17 01:14:39 +04:00
Justin Love 11df150531 support gets-with-limit from ruby 1.9 2012-12-07 20:53:22 -06:00
Mark Hubbart 31259bb416 preserves order of zipfile entries
Makes ZipEntrySet preserve the original order of files in the zipfile.
Also preserves the insertion order of files.
2012-10-19 12:24:02 -07:00
rap-kasta 1ee0f16183 Averting of compression method override 2012-09-14 13:52:20 +06:00
Justin Love 3406ad49cd read boundaries could break a multi-character gets terminator 2012-08-29 19:11:23 -05:00
Justin Love d45d656353 Merge branch 'master' into pos 2012-07-05 13:56:26 -05:00
Alexander Simonov 023ff8497e Remove unused require 2012-06-17 23:44:22 +03:00
Alexander Simonov f9d390496a Fix #1 2012-06-17 23:35:38 +03:00
Alexander Simonov 4e8b20f32b Fix #53 again... 2012-06-17 23:12:56 +03:00
Alexander Simonov 381355f216 Fix #53 2012-06-17 20:10:34 +03:00
Alex Dowad e14859a979 Added Zip::ZipFile.open_buffer 2012-05-21 12:21:12 +03:00
Alexander Simonov dbc0213633 Merge pull request #48 from yaauie/feature/glob
Add ZipFile#glob and ZipFileSystem#glob
2012-05-19 01:36:59 -07:00
Ryan Biesemeyer 739b352f32 add glob support in ZipFile and ZipFileSystem, refactor existing ZipEntrySet#glob to accept block and be more memory efficient with results. 2012-05-18 21:57:19 +00:00
Bernie Telles bb53c0aff4 manually require NullInputStream, otherwise it doesn't get recognized 2012-04-26 13:04:30 -07:00
Julien Ammous 07068d1134 bugfix: get correct size for utf8 strings 2012-04-12 12:01:40 +02:00
Alexander Simonov daa21eb85e Version bump 2012-04-08 00:21:02 +03:00
Dylan Markow c60520f299 Properly commit when the comment is the only thing changed. 2012-04-06 16:40:21 -07:00
Alexander Simonov 82c2037cf6 Merge pull request #40 from edouard/keep_entry_mtime
ZipEntry modification time isn’t saved in zip file
2012-03-27 02:50:38 -07:00
Édouard Brière 9268fefaf1 Fix: ZipOutputStream#put_next_entry now keeps entry modification time 2012-03-27 11:31:13 +02:00
wpc d33d8c2398 Fix performance issue on ZipFile#find_entry when reading/writing zip
file with large amount of files and directories.
2012-03-26 00:05:06 -07:00
Alexander Simonov 2faee060f8 Fix #29 2012-03-13 10:26:51 +02:00
Alexander Simonov 7205983957 Refactoring 2012-03-13 10:14:57 +02:00
Alexander Simonov f9b9a30b6f Refactoring 2012-03-13 10:13:58 +02:00
Alexander Simonov 6712879287 Merge pull request #31 from Fuzion24/master
Unzipping fails when file attributes are 0
2012-03-13 01:06:36 -07:00
Alexander Simonov dfca45d4b0 Merge pull request #32 from jsanders/namespace_dos_time
Add Zip namespace to DOSTime class
2012-03-13 01:04:53 -07:00
kellydunn 7830a83b52 [lib][test] Renaming option for simplicity 2012-03-12 16:34:50 -07:00
kellydunn 1de6e2b73c [lib][settings] Renaming options for clearer description of implementation 2012-03-12 13:45:02 -07:00
kellydunn 32f02579d0 [lib] Requiring settings upon init, revising implementation. 2012-03-12 13:39:46 -07:00
kellydunn db70959751 [settings] Adding in settings.rb 2012-03-12 13:34:35 -07:00
James Sanders ab99778c37 Add Zip namespace to DOSTime class
In the top level, it conflicts with the archive-zip library's class of
the same name.
2012-03-01 10:30:49 -07:00
Ryan Welton 8c45c67a86 A zip file with externalFileAttributes == 0 causes unknown filetype... 2012-02-28 15:44:15 -05:00
KOJIMA Satoshi 963f23c9ed do not sort entries on ZipCentralDirectory#write_io_stream 2012-02-19 22:34:50 +09:00
Lucas Hills c68770f3a3 Added better support for ruby187 mingw developers 2012-02-06 11:59:11 +11:00
Lucas Hills 183deb7be0 Fixed replace method 2012-02-06 11:57:06 +11:00
Lucas Hills 26ec16866e mingw ruby187 does not recognise utf8 2012-02-06 11:52:27 +11:00
Jean Boussier 85054091e8 Get rid of Time extensions 2012-02-01 11:16:13 +01:00
Jean Boussier 219b853412 Get rid of String#lchop 2012-02-01 11:10:34 +01:00
Jean Boussier dc159646e6 Get rid of String#ensure_end 2012-02-01 10:59:56 +01:00
Jean Boussier a92b601f98 Get rid of unused Enumerable#select_map 2012-02-01 10:48:25 +01:00
Jean Boussier 1b777ef184 Get rid of Module#forward_message 2012-02-01 10:47:17 +01:00
Alexander Simonov 028262700e Rubyzip and Zipruby conflict Fix #6 2012-01-31 21:46:42 +02:00
KOJIMA Satoshi 1625f76265 added ZipInputStream::open_buffer 2012-01-26 22:50:25 +09:00
Justin Love 8d53a0197a support pos for CSV line ending auto detection and progress tracking 2012-01-02 10:48:07 -06:00
Alexander Simonov 3418d31b44 Code cleanup 2011-11-17 22:53:04 +02:00
Alexander Simonov 7cb60f5a37 Fix for UTF-8 filenames 2011-11-17 22:28:44 +02:00
Alexander Simonov 9aa578e487 Fix constants 2011-11-17 22:27:26 +02:00
alor 16b6400a12 code cleanup 2011-11-17 13:29:44 +01:00
alor bb7c918dec don't make chown dirty (not my job) 2011-11-17 11:11:45 +01:00
alor 4f9595c23b open() can accept permissions
chown() is now working by setting the dirty flag
commit_required? returns true if at least one ZipEntry is dirty
2011-11-17 10:48:42 +01:00
alor 7be1b9c55a indent to spaces 2011-11-16 16:17:19 +01:00
alor b89aeb71df indent to spaces 2011-11-16 16:11:18 +01:00
alor a354ea08dc indent to spaces 2011-11-16 16:09:14 +01:00
alor 8610ec9eec correct code indentation 2011-11-16 16:04:28 +01:00
Xavier Shay 9116110cfe Don't use iconv on 1.9, use native encodings instead. 2011-11-14 18:50:42 +11:00
Xavier Shay ec04e20b21 Extract constants into a file to avoid redefinition (and associated warnings) 2011-11-14 18:48:34 +11:00
Alan Harper 446c114b75 Split version out in to useful constant 2011-10-05 07:49:33 +11:00
Alan Harper 43e6a5a06c Merge pull request #7 from alown/master
Sort Central Directory
2011-09-21 14:53:48 -07:00
Alan Harper a3c72e7127 Merge pull request #5 from dmgarland/master
Escape Regex to allow characters such as parentheses into filenames
2011-09-21 14:50:45 -07:00
Alan Harper 794c9463fc Removed support for loading ruby in zip files 2011-09-21 22:46:54 +10:00
Ali Lown 74e4512387 Sort before commiting Central Directory
-Fixes an issue I had by ensuring that it unzips in the correct order!
2011-06-11 22:42:38 +01:00
Daniel M Garland 0e83e30940 Escaping the path to allow for characters such as brackets within zip paths. 2011-02-01 11:47:24 +00:00
Alan Harper 0a326dce2b Merge branch 'master' of https://github.com/LyagushkaLimited/rubyzip into LyagushkaLimited-master
* 'master' of https://github.com/LyagushkaLimited/rubyzip:
  Added Support for write data to bugger using ZipFile.add_buffer do {|zf| ... } => buffer
2011-01-07 23:23:22 +10:00
Alan Harper 8f64fe1035 Revert "Started converting to RSpec"
This reverts commit c36359d612.
2011-01-07 22:59:51 +10:00
David Henry 13d5f6c46d Added Support for write data to bugger using ZipFile.add_buffer do {|zf| ... } => buffer 2010-12-06 10:00:03 +00:00
Alan Harper c36359d612 Started converting to RSpec 2010-11-30 23:11:30 +10:00
Alan Harper cd038ae442 Split Zip module up by class in to seperate files 2010-11-30 18:27:59 +10:00
thomas 3bf664c07f Don't react to strongly on incorrect encoding of external file attributes. 2010-09-10 19:56:37 +00:00