Jan-Joost Spanjers
456bd4d92c
Mimic IO#read return values in Decompressor#read
2020-01-26 15:34:17 +01:00
Jan-Joost Spanjers
c66277db58
Rename Decompressor#sysread to #read
2020-01-26 15:34:17 +01:00
Jan-Joost Spanjers
00b525d76e
Fix returned outbuf for Inflater#sysread
2020-01-26 15:34:17 +01:00
Jan-Joost Spanjers
cda7127107
Add Decompressor#input_stream
2020-01-26 15:34:17 +01:00
Jan-Joost Spanjers
5707c52a15
Move PassTruDecompressor#decompressed_size to Decompressor
2020-01-26 15:34:17 +01:00
Jan-Joost Spanjers
2bbcec0e34
Cleanup PassTruDecompressor
2020-01-26 15:34:17 +01:00
Jan-Joost Spanjers
4ac83737b1
Cleanup Inflater
2020-01-26 15:34:17 +01:00
Jan-Joost Spanjers
dd74bc0e73
Cleanup NullDecompressor
2020-01-26 15:34:17 +01:00
Jan-Joost Spanjers
b80ce3cc57
Make decryption generic for all compression methods
...
Now, STORED files can be decrypted, just like DEFLATED files.
2020-01-26 15:34:17 +01:00
Jan-Joost Spanjers
4e28f7286c
Untangle encryption and decompression
2020-01-26 15:34:17 +01:00
Jan-Joost Spanjers
8f7c5caf29
Drop #produce_input from Decompressor class
2020-01-26 15:34:17 +01:00
Jan-Joost Spanjers
d20a6834a3
Rework Inflater#produce_input to use sysread
...
This aligns Inflater#produce_input with
PassThruDecompresser#produce_input.
2020-01-26 15:34:17 +01:00
Jan-Joost Spanjers
1b6aeb2cd0
Replace Decompressor#input_finished? with #eof
2020-01-26 15:34:17 +01:00
Jan-Joost Spanjers
4a4c553b1e
Move :eof from InputStream to AbastractInputStream
2020-01-26 15:34:17 +01:00
Jan-Joost Spanjers
e072c57beb
Add Entry#incomplete?
2020-01-26 15:34:17 +01:00
Jan-Joost Spanjers
c897bbdf77
Add Entry#encrypted?
2020-01-26 15:34:17 +01:00
Jan-Joost Spanjers
0b7b78dc4a
Encapsulate Zlib errors within DecompressionError
2020-01-26 15:34:13 +01:00
John Lees-Miller
f6639f9b55
Bump version to 2.1.0
2020-01-25 18:12:57 +00:00
Robert Haines
ee028d2746
UniversalTime: more ruby-like (readable) code.
2019-12-15 22:42:09 +00:00
Robert Haines
9849500d73
UniversalTime: correctly parse included timestamps.
...
From the documentation: "...times that are present will appear in the
order indicated, but any combination of times may be omitted. (Creation
time may be present without access time, for example.)"
This fixes the parsing so that the times are read into the correct
fields, according to the flags. Before they were simply assumed to be in
order and all present.
2019-12-15 22:37:29 +00:00
Robert Haines
a5e785c737
UniversalTime: better check for size on parse.
2019-12-15 22:26:06 +00:00
Robert Haines
65cfd8a9a5
UniversalTime: correctly pack/unpack the timestamps.
...
From the documentation: "The time values are in standard Unix signed-long
format, indicating the number of seconds since 1 January 1970 00:00:00."
The three time values were being unpacked with 'VVV', which is unsigned
32-bit, but they should be unpacked with 'l<l<l<': signed-long little
endian.
2019-12-15 22:26:06 +00:00
Robert Haines
b58b97fe23
UniversalTime: correctly set the flags.
...
When a timestamp is set/unset the flags should reflect this.
2019-12-15 22:26:06 +00:00
Robert Haines
2d6b6e024b
Ensure File#get/find_entry work consistently.
...
I have switched around the logic somewhat so that `get_entry` calls
`find_entry` and raises an exception if it gets `nil` back.
2019-10-31 18:12:18 +00:00
Robert Haines
0f6ca04a9d
Set the default options in `Entry` the same as `File`.
2019-10-31 17:30:14 +00:00
Robert Haines
2bdd37d894
Add a convenience method for creating DOSTime instances.
...
DOSTime::from_time creates a DOSTime instance from a vanilla Time
instance.
2019-10-20 19:30:34 +01:00
Robert Haines
8c694d38ee
Add functionality to restore file timestamps.
...
There has been an option in `Zip::File` (`:restore_times`) for a long
time, but it seems it has never worked. Firstly the actual timestamp of
an added file wasn't being saved, and secondly an extracted file wasn't
having its timestamp set correctly.
This commit fixes both of those issues, and adds tests to make sure.
2019-10-20 19:30:27 +01:00
Robert Haines
378293539d
Make the attr_accessors in File more readable.
...
Note what the default is and that a couple of them will change at some
point soon.
2019-10-19 20:46:21 +01:00
Robert Haines
253457545e
Correctly set/default options in the File class.
...
Fixes #395 . Set the options to false for now for consistency.
2019-10-19 20:45:29 +01:00
John Lees-Miller
056c00cb16
Merge pull request #418 from hainesr/open-options
...
Add `options` parameter to `Zip::File.open`.
2019-10-19 17:38:38 +01:00
Robert Haines
3fea9958c2
Update comment for `Zip::File.open`.
2019-10-19 07:15:51 +01:00
Robert Haines
f58e38012c
Add the `options` parameter to `Zip::File.open`.
2019-10-19 07:04:04 +01:00
Robert Haines
935a4f31a2
Make warning messages consistent.
...
And fix a few spelling mistakes.
2019-10-12 12:52:04 +01:00
Robert Haines
340379f080
Use `warn` instead of `puts` for messages from the library code.
...
`warn` has the advantage of easily being disabled by, the `-W0` interpreter
flag or setting $VERBOSE to nil.
2019-10-11 19:31:42 +01:00
Robert Haines
e87184200a
Require 'tmpdir' only in the tests.
...
It's not used in the library code.
2019-09-27 16:28:02 +01:00
Robert Haines
506d557edc
StreamableStream now uses the OS temp directory.
...
Rather than using the local folder.
Fixes #410
2019-09-27 16:13:56 +01:00
John Lees-Miller
cb407b1065
Bump version to 2.0.0
2019-09-25 21:10:05 +01:00
John Lees-Miller
7c65e1e359
Bump version to 1.3.0
2019-09-25 19:59:24 +01:00
John Lees-Miller
97cb6aefe6
Warn when an entry size is invalid
2019-09-18 18:34:23 +01:00
John Lees-Miller
7849f7362a
Default validate_entry_sizes to false for 1.3 release
2019-09-15 15:23:35 +01:00
John Lees-Miller
4167f0ce67
Validate entry sizes when extracting
2019-09-15 15:11:35 +01:00
Robert Haines
ecb2776218
Zip::File.add_stored() to add uncompressed files.
...
Adding uncompressed files to a zip archive can be overly complex, so
this convenience method makes it easier.
2019-09-14 13:58:30 +01:00
John Lees-Miller
0d85cb6a49
Bump to 1.2.4
2019-09-06 18:01:30 +01:00
John Lees-Miller
7fbaf1e6c0
Merge pull request #360 from hainesr/fix-open-buffer
...
Fix #280 - `open_buffer` mangles the content of the buffer it is given.
2019-09-05 18:48:39 +01:00
John Lees-Miller
6f0b219265
Merge pull request #393 from rubyzip/v1-2-3
...
Bump version to 1.2.3
2019-05-23 19:33:53 +02:00
John Lees-Miller
fb1c230cac
Bump version to 1.2.3
2019-03-22 18:14:23 +02:00
John Lees-Miller
ad15c3c494
Allow tilde in zip entry names
...
Use absolute_path rather than expand_path to allow tilde to pass through
unchanged. Otherwise, we try to expand it to a home directory.
2019-03-22 16:30:25 +02:00
John Lees-Miller
bb3488723f
Merge pull request #385 from mihyaeru21/remove-commas
...
remove some strange commas
2019-03-21 22:22:32 +02:00
John Lees-Miller
3219d8e5af
Merge pull request #390 from taichi-ishitani/master
...
fixed FrozenError caused by frozen-string-literal
2019-03-21 21:58:17 +02:00
taichi
74f0d4eabb
fixed errors caused by frozen-string-literal
2019-02-28 01:23:29 +09:00
David Ryskalczyk
a420323c84
require pathname where it is used
2019-02-10 11:51:29 -05:00
Mihyaeru
afb1b79efd
remove some strange commas
2018-12-04 00:14:32 +09:00
John Lees-Miller
fd81bd523c
Bump version to 1.2.2
2018-08-27 09:07:21 +01:00
John Lees-Miller
cf35774ed6
Bump version to 1.3.0
2018-08-27 09:02:11 +01:00
John Lees-Miller
ffb374c6b1
Bump version to 2.0.0
2018-08-27 08:37:53 +01:00
John Lees-Miller
8a1de58286
Expand from root rather than current working directory
2018-08-26 19:55:26 +01:00
John Lees-Miller
3dd165b494
Disable symlinks and check for path traversal
2018-08-26 14:21:38 +01:00
Bart de Water
8e78311d67
Fix CVE-2018-1000544 symlink path traversal
...
Not sure if the exception is the right way to go
2018-08-23 18:14:48 -04:00
Bart de Water
6e0d23178a
Fix CVE-2018-1000544 absolute path traversal
...
Small refactor along the way to centralize destination handling when no explicit path is given and a potential malicious one from the zipfile is used
2018-08-23 18:14:48 -04:00
Robert Haines
aa6284db7a
When globbing in ZipFSDir, take CWD into account.
2018-04-30 20:06:21 +01:00
Robert Haines
1673da744d
Pass glob through from ZipFileNameMapper.
...
Just pass the basic glob straight through to the underlying Zip::File
implementation.
2018-04-30 19:59:02 +01:00
Robert Haines
84c208982f
Switch newly created StringIOs to binmode.
...
StringIO objects created within File.open_buffer were not being switched into
binmode, but those passed in were. Fix this inconsistency and add a test.
2018-04-04 16:02:19 +01:00
Robert Haines
15ccc25da1
Fix File.open_buffer when no changes are made.
...
Things are now more carefully set up, and if a buffer is passed in which
represents a file that already exists then this is taken into account. All
initialization is now done in File.new, rather than being split between there
and File.open_buffer.
This has also needed a bit of a re-write of Zip::File.initialize. I've tried to
bring some logic to it as a result, and have added comments to explain what is
now happening.
2018-04-04 15:54:12 +01:00
Robert Haines
03633933eb
No need to require stringio in Zip::File.open_buffer.
...
It's already required in zip.rb.
2018-04-04 14:31:34 +01:00
Robert Haines
cfa9441914
Handle passing an IO to Zip::File.new better.
...
This now actually extracts the path from the IO if one is passed in.
2018-04-03 23:48:54 +01:00
Robert Haines
7cd263e6a0
Clean up use of file_name in Zip::File::initialize.
2018-04-03 23:45:04 +01:00
Andrew Meyer
c787d94852
Handle stored files with general purpose bit 3 set
...
Signed-off-by: Sam Coward <scoward@pivotal.io>
2018-04-03 16:07:18 -04:00
Oleksandr Simonov
05af1231f4
Merge pull request #353 from pnomolos/pnomolos/fix_stringio
...
Added fix for calling 'close' on a StringIO-backed zip file, and specs
2018-03-30 16:58:27 +03:00
Phil
ffd0b671b8
Fix regression caused by Rubocop cleanup
...
InputStream:
```
if @current_entry && @current_entry.gp_flags & 8 == 8 && @current_entry.crc == 0 \
&& @current_entry.compressed_size == 0 \
&& @current_entry.empty? && !@internal
```
`Zip::Entry#empty?` doesn't exist, but an automatic Rubocop check thought it should be converted from `size == 0`.
Unfortunately, this is tricky to write a test for as it only fails under some very specific conditions.
2018-02-23 13:22:57 -08:00
Phil
792266dbf3
Added fix for calling 'close' on a StringIO-backed zip file, and specs
2018-02-21 11:48:56 -08:00
Oleksandr Simonov
57c3772d94
Merge pull request #325 from aeroastro/feature/tempfile-directory
...
Save temporary files to a temporary directory
2017-11-08 20:38:22 +02:00
Alexey Sorokin
deb6616c5f
Merge branch 'master' into force-entry-names-encoding-option
2017-10-18 19:24:58 +03:00
Alexey Sorokin
a9f020c0a0
add option to force entry names encoding
...
if you need to work with existing zip files which contain names with
non-ascii characters then you can specify this option.
Without this option find_entry will not work properly
2017-10-18 18:20:56 +03:00
Takumasa Ochi
cf91112b57
Apply automatic correction by rubocop
2017-06-29 11:57:12 +09:00
Takumasa Ochi
258ef02914
Save temporary files to a temporary directory
2017-06-27 09:17:55 +09:00
Alexander Simonov
98f4f2ed9b
Version bump
2017-02-08 13:50:16 +02:00
Alexander Simonov
ce4208fdec
Fix #315 and resolve relative path vulnerability
2017-02-08 13:43:14 +02:00
Alexander Simonov
df8dfbcff3
Merge pull request #314 from mwlang/bugfix/open_buffer_without_block
...
allows open_buffer to work without a given block
2017-02-08 13:16:06 +02:00
mwlang
14b8fed18c
allows open_buffer to work without a given block
2017-01-16 13:24:22 -06:00
Koichi ITO
960414aff0
Fix warnings: `constant ::Fixnum is deprecated` in Ruby 2.4
2017-01-08 16:41:23 +09:00
dogatana
a4e3b55bb2
remove tr to support cp932 encoding
2016-12-07 22:35:33 +09:00
Alexander Simonov
a0cf673186
Merge pull request #300 from hainesr/fix-create-perms
...
Fix permissions on new zip files (#294 )
2016-11-09 22:19:04 +02:00
Alexander Simonov
82fa57cc83
Merge pull request #303 from deivid-rodriguez/extended_globbing
...
Extended globbing
2016-11-09 22:17:17 +02:00
knut2
579e78f1ef
Update entry.rb
...
Add accessor to @internal_file_attributes
See http://stackoverflow.com/questions/39800771/hot-to-set-binary-flag-in-zip-file-with-rubyzip
2016-10-10 23:04:36 +02:00
David Rodríguez
9c475f5160
Add extended globbing support
2016-10-08 19:32:53 -03:00
Robert Haines
c00d767533
Fix rubocop offence caused by temp files changes.
2016-09-05 17:34:12 +01:00
Robert Haines
fc23f68f77
Refactor the create logic in Zip::File.
...
Make the internal @create varible more consistent and actually match the
documentation.
Zip::File::CREATE is now true, rather than 1.
A new test is added to check if passing 1 in still works to ensure backwards
compatibility.
2016-09-05 15:16:57 +01:00
Robert Haines
63ed0d970b
Refactor the code which manages temp files.
...
Combine the creation of the temporary filename with the writing to it.
2016-09-05 15:07:18 +01:00
Robert Haines
7b14d11c00
Stop using 0600 perms for temporary files.
...
This fixes #294 in what I hope is a more sensible way than trying to mess with
umasks, etc, directly.
Temporary files were being created with 0600 permissions and then being set to
different permissions, based on umask, etc, afterwards. I don't know what the
rationale for this was, but there were errors in the umask calculations when
moving from the temporary file to the intended end result.
2016-09-01 12:10:56 +01:00
Alexander Simonov
3ec40d875d
Version bump
2016-02-19 11:14:57 +02:00
Alexander Simonov
560bf5d432
Merge pull request #259 from mnaberez/remove-tempfile
...
Fix accidental unlink (#185 ) without using ObjectSpace (#252 )
2016-01-05 00:37:53 +02:00
Alexander Simonov
972749c518
Merge pull request #263 from ShockwaveNN/feature/fix-warn-date-tests
...
Add correct test for `Zip.warn_invalid_date` attribute
2016-01-05 00:37:17 +02:00
Oleksandr Avoiants
73bfa5955c
Fix TypeError: can't dup NilClass from EntrySet#dup
2015-12-19 11:26:20 +02:00
Pavel Lobashov
73a35d4515
User `warn` method instead `STDERR.puts` to correctly check error in tests
...
See http://stackoverflow.com/questions/34351144/minitest-assert-output-incorrect-check-for-stderr
about this
2015-12-18 16:40:24 +03:00
Mike Naberezny
6e1dea4f66
Fix accidental unlink ( #185 ) without using ObjectSpace ( #252 )
2015-11-22 14:40:59 -08:00
Alexander Simonov
8447f0e230
Fix #252
2015-11-21 12:07:30 +02:00
Felix Bünemann
7a4b8bb048
Fix high memory usage due to Deflater buffering
...
When support for ZipCrypto was added, an internal StringIO buffer was
added to Deflater, in order to fix a decryption bug. While this worked,
it caused unlimited memory growth when compressing large files. The
proper fix is to writer the encryption header in init_next_entry instead
of finalize_current_entry, so the headers are written before any
encrypted data. Because of this fix we can remove the buffering in
Deflater, which keeps memory usage low and allows to stream compressed
data while it is written.
This should fix issue #233 .
2015-10-17 17:06:41 +02:00
Victor Costan
77acc03ddb
Fix exception due to calling empty? on nil.
2015-09-30 03:57:21 -04:00
Seth Kingsley
05a9ba3f20
Use duck typing to detect IO-like objects.
2015-09-03 06:16:32 -07:00
Claire Pitman
a1f75a3ab9
Added error for empty (zero bit) zip file. Added tests for empty and non existant zips
2015-07-27 23:20:59 -07:00
Victor Costan
37a5baad96
Accept StringIO in Zip.open_buffer.
2015-07-02 14:17:17 -04:00
Robert Haines
9acc50f004
Do something more expected with new file permissions.
...
Instead of inheriting the permissions from the tmp directory, new files should
have permissions that reflect the defaults on the system taking umask into
account.
It seems that (unix) permissions of 666 - umask are as close to a standard as
anything [1] and that 'touch' uses this. On Windows it seems sensible to just
use 644 directly [2].
[1] http://unix.stackexchange.com/a/102080
[2] http://ruby-doc.org/core-1.9.3/File.html
2015-06-24 18:25:22 +01:00
Pavel Lobashov
1e99ff69b9
Revert "fix rubocop cop Style/ClassCheck". It cause regression in tests
...
This reverts commit 8c13dfc265
.
2015-06-08 10:45:23 +03:00
Pavel Lobashov
8c13dfc265
fix rubocop cop Style/ClassCheck
2015-06-08 10:36:41 +03:00
Pavel Lobashov
4c81b1151a
fix rubocop cop Style/NilComparison
2015-06-08 10:30:12 +03:00
Pavel Lobashov
13658b0586
fix rubocop cop Style/NonNilCheck
2015-06-08 10:29:08 +03:00
Pavel Lobashov
f7eec2dd76
fix rubocop cop Style/SpaceAroundOperators
2015-06-08 10:26:13 +03:00
Pavel Lobashov
c0177a455b
Merge branch 'master' into rubocop_fixes
...
Conflicts:
README.md
samples/example_recursive.rb
2015-06-08 10:14:25 +03:00
Alexander Simonov
d289780072
Fix #234 . Add special variable what is a flag about internal usege
2015-06-07 17:29:54 +03:00
Vít Ondruch
32016ab1bf
Remove executable bit.
2015-03-31 13:15:46 +02:00
Pavel Lobashov
2007be0ab6
fix rubocop Lint/UselessAccessModifier cop
2015-03-24 19:47:49 +03:00
Pavel Lobashov
fd864bd7ab
fix rubocop Style/CaseEquality cop
2015-03-24 19:44:47 +03:00
Pavel Lobashov
96f3997f07
fix rubocop Style/GuardClause cop
2015-03-24 19:33:15 +03:00
Pavel Lobashov
ce7e01a206
fix rubocop Style/CommentIndentation cop
2015-03-24 19:31:28 +03:00
Pavel Lobashov
784e70be2a
fix rubocop Style/EmptyElse cop
2015-03-24 19:29:07 +03:00
Pavel Lobashov
112a77de7c
fix some Style/FormatString cop
2015-03-24 19:20:39 +03:00
Pavel Lobashov
b920a1eb49
fix rubocop Style/GuardClause cop
2015-03-24 19:16:03 +03:00
Pavel Lobashov
b9aefaffb5
fix rubocop Style/IfUnlessModifier cop
2015-03-24 19:09:22 +03:00
Pavel Lobashov
2c8f6f8cbd
fix correct initialization for ExtraField
2015-03-24 19:04:28 +03:00
Pavel Lobashov
b1bfb1a216
fix some rubocop Style/ModuleFunction cop
2015-03-23 19:36:47 +03:00
Pavel Lobashov
1ba81ff46f
fix rubocop Style/NumericLiterals cop
2015-03-23 19:23:04 +03:00
Pavel Lobashov
31fb9d729b
fix rubocop Style/PredicateName cop
2015-03-23 19:18:51 +03:00
Pavel Lobashov
f291e1f616
fix rubocop Style/NegatedIf cop
2015-03-23 19:11:32 +03:00
Pavel Lobashov
6a7a22fece
fix rubocop Style/MultilineOperationIndentation cop
2015-03-23 19:10:39 +03:00
Pavel Lobashov
47b72f5cab
fix rubocop Style/LeadingCommentSpace cop
2015-03-23 19:06:01 +03:00
Pavel Lobashov
d5f79822c1
fix rubocop Style/LineEndConcatenation cop
2015-03-23 19:03:28 +03:00
Pavel Lobashov
edf3126599
EntrySet.dub fix for code-style
2015-03-23 18:57:56 +03:00
Pavel.Lobashov
8d6f23ba9a
fix rubocop Style/SpaceAroundOperators cop
2015-03-22 20:03:50 +03:00
Pavel.Lobashov
5ea5710b18
fix rubocop Style/SpaceBeforeBlockBraces cop
2015-03-22 19:59:33 +03:00
Pavel.Lobashov
d92d8d652a
fix rubocop Style/SpaceInsideParens cop
2015-03-22 19:56:37 +03:00
Pavel.Lobashov
b13fafb7e8
fix rubocop Style/StringLiterals cop
2015-03-22 19:54:44 +03:00
Pavel.Lobashov
b311998e25
fix rubocop Style/SpaceInsideBlockBraces cop
2015-03-22 19:49:07 +03:00
Pavel.Lobashov
cb143f0cff
fix rubocop Style/SpaceAroundEqualsInParameterDefault cop
2015-03-22 19:45:26 +03:00
Pavel.Lobashov
77ef05cf84
fix rubocop Style/SpaceAfterNot cop
2015-03-22 19:44:44 +03:00
Pavel.Lobashov
73e5f70bdf
fix rubocop Style/SpaceAfterMethodName cop
2015-03-22 19:43:44 +03:00
Pavel.Lobashov
d2b4a528de
fix rubocop Style/SpaceAfterComma cop
2015-03-22 19:41:47 +03:00
Pavel.Lobashov
707bd44e66
fix rubocop Style/SingleLineMethods cop
2015-03-22 19:37:59 +03:00
Pavel.Lobashov
735a0553a3
fix rubocop Style/RedundantBegin cop
2015-03-22 19:33:44 +03:00
Pavel.Lobashov
105c2c71b2
fix rubocop Style/RedundantException cop
2015-03-22 19:32:47 +03:00
Pavel.Lobashov
abf9cbec23
fix rubocop Style/RedundantSelf cop
2015-03-22 19:30:24 +03:00
Pavel.Lobashov
225a4f70ce
fix rubocop Style/RedundantReturn cop
2015-03-22 19:27:29 +03:00
Pavel.Lobashov
06e5a9352d
fix rubocop Style/ParenthesesAroundCondition cop
2015-03-22 19:25:35 +03:00
Pavel Lobashov
b730387cf2
redone fixes by rubocop Style/Alias to be in style of https://github.com/bbatsov/ruby-style-guide#alias-method-lexically
2015-03-21 13:14:21 +03:00
Pavel Lobashov
da863e4b55
Merge branch 'master' into rubocop_fixes
...
Conflicts:
lib/zip/entry.rb
2015-03-21 11:37:28 +03:00
Pavel Lobashov
b93ef1266f
fix rubocop Style/StringLiterals cop
2015-03-21 11:27:44 +03:00
Pavel Lobashov
f67cf18e45
fix rubocop Style/EmptyLinesAroundModuleBody cop
2015-03-21 11:22:47 +03:00
Pavel Lobashov
b9a757e045
fix rubocop Style/EmptyLinesAroundClassBody cop
2015-03-21 11:21:26 +03:00
Pavel Lobashov
eba5fa1983
fix rubocop Style/EmptyLinesAroundAccessModifier cop
2015-03-21 11:19:43 +03:00
Pavel Lobashov
d0c8e8df60
fix rubocop Style/EmptyLines cop
2015-03-21 11:19:14 +03:00
Pavel Lobashov
6c46c21abb
fix rubocop Style/ColonMethodCall cop
2015-03-21 11:16:06 +03:00
Pavel Lobashov
a0da550c22
fix rubocop Style/CaseIndentation cop
2015-03-21 11:12:01 +03:00
Pavel Lobashov
d2d8590ef8
fix rubocop Style/Blocks cop
2015-03-21 11:10:37 +03:00
Pavel Lobashov
0c6a10e631
fix rubocop Style/AndOr cop
2015-03-21 10:48:05 +03:00
Pavel Lobashov
a2afbafacf
fix rubocop Style/AndOr cop
2015-03-21 10:45:46 +03:00
Pavel Lobashov
98e6b5d057
fix rubocop Style/AlignParameters cop
2015-03-21 10:44:56 +03:00
Pavel.Lobashov
bb08213cb7
fix rubocop Style/Alias cop
2015-03-20 23:17:05 +03:00
Pavel.Lobashov
4ee6d6be39
fix rubocop Lint/UnusedMethodArgument cop
2015-03-20 23:09:41 +03:00
Pavel.Lobashov
d3e911f04d
fix rubocop Lint/UnusedBlockArgument cop
2015-03-20 23:07:59 +03:00
Pavel.Lobashov
67838e13ac
fix rubocop Lint/EndAlignment cop
2015-03-20 23:00:20 +03:00
Pavel.Lobashov
6d19df491a
fix rubocop Lint/AssignmentInCondition cop
2015-03-20 22:57:38 +03:00
Pavel.Lobashov
d928aeebe5
make parse_zip64_extra check for empty @extra['Zip64'] easier to read
2015-03-20 22:54:28 +03:00
Pavel.Lobashov
c45a639c54
fix rubocop Style/TrailingBlankLines cop
2015-03-20 22:45:50 +03:00
Pavel.Lobashov
7dcba79bb5
fix rubocop Style/TrailingComma cop
2015-03-20 22:44:21 +03:00
Pavel.Lobashov
6fac8c7e86
fix rubocop Style/TrailingWhitespace cop
2015-03-20 22:43:29 +03:00
Pavel.Lobashov
b7cda26ea6
fix rubocop Style/WhileUntilDo сщз
2015-03-20 22:38:09 +03:00
Pavel Lobashov
7a8a8b6fd2
fix rubocop Style/WhileUntilModifier warning
2015-03-20 18:33:43 +03:00
Alexander Simonov
4698e5743e
Merge pull request #224 from weshatheleopard/master
...
Less sloppy implementation of case insensitive matching
2015-03-19 20:10:36 +02:00
Pavel Lobashov
17ac4fdba1
Fix #218
...
Ouput Invalid Date/time to STDERR
2015-03-19 17:32:33 +03:00
weshatheleopard
d81e0f207d
Oops, forgot to remove
2015-03-11 09:41:03 -05:00
weshatheleopard
f030cdadb8
...and remove that crazy abomination
2015-03-08 13:40:43 -05:00
weshatheleopard
cfc38b30a1
PROPER case insensitivity handling
2015-03-08 13:38:57 -05:00
Alexander Simonov
070411ef5c
Merge pull request #222 from rastarobot/find_entry_case_insensitively
...
Case insensitivity option for #find_entry
2015-03-07 12:22:24 +02:00
Sergey Konotopov
b7fa9b124e
Fixing Zip#read_local_entry error on JRuby
2015-03-07 12:50:13 +03:00
Sergey Konotopov
61a4435cc3
Case insensitivity option for #find_entry
2015-02-20 01:20:07 +03:00
Alexander Simonov
0cb838f019
Fix #221
2015-02-16 21:51:44 +02:00
Alexander Simonov
0cbae14c76
Version bump
2015-02-03 00:00:09 +02:00
Alexander Simonov
721c1f05ed
Merge pull request #201 from mcantor/master
...
Be smarter about handling buffer file modes
2015-01-17 12:21:32 +02:00
Alexander Simonov
9e7af06a0b
Merge pull request #209 from johnnyshields/master
...
Support for Traditional Encryption (ZipCrypto) + Tests
2015-01-17 12:20:52 +02:00
Alexander Simonov
a23b30697a
Merge pull request #185 from maneframe/master
...
prevent tempfile path from being unlinked by garbage collection
2015-01-16 20:43:53 +02:00
Shigeaki Matsumura
85a7bbdf1a
add data descriptor for each entries when encrypto
2015-01-08 18:30:32 +09:00
Shigeaki Matsumura
bd5a7e4081
fix to file size with encrption
2015-01-07 10:45:01 +09:00
Shigeaki Matsumura
87d1a5a775
added test cases for encryption support
2015-01-06 00:49:16 +09:00
Shigeaki Matsumura
fd26052525
fix to encryption bug
2015-01-04 22:49:58 +09:00
Johnny Shields
c2ecafe770
Change method interfaces to allow encrypter/decrypter to be passed into stream methods
2015-01-04 04:07:51 +09:00
Johnny Shields
23f2ead7ee
- Move encryption related files to /lib/zip/crypto/ dir
...
- NullEncrypter and NullDecrypter should inherit Encrypter and Decrypter respectively
- Add copyright notice to bottom of added files for consistency
2015-01-04 03:37:43 +09:00
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