Commit Graph

303 Commits

Author SHA1 Message Date
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