Commit Graph

75 Commits

Author SHA1 Message Date
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
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 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
John Lees-Miller 97cb6aefe6 Warn when an entry size is invalid 2019-09-18 18:34:23 +01:00
John Lees-Miller 4167f0ce67 Validate entry sizes when extracting 2019-09-15 15:11:35 +01: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 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
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
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
Alexander Simonov ce4208fdec
Fix #315 and resolve relative path vulnerability 2017-02-08 13:43:14 +02:00
dogatana a4e3b55bb2 remove tr to support cp932 encoding 2016-12-07 22:35:33 +09: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
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
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
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 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 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 8d6f23ba9a fix rubocop Style/SpaceAroundOperators cop 2015-03-22 20:03:50 +03:00
Pavel.Lobashov b13fafb7e8 fix rubocop Style/StringLiterals cop 2015-03-22 19:54:44 +03:00
Pavel.Lobashov 73e5f70bdf fix rubocop Style/SpaceAfterMethodName cop 2015-03-22 19:43: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 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 b9a757e045 fix rubocop Style/EmptyLinesAroundClassBody cop 2015-03-21 11:21:26 +03:00
Pavel Lobashov 6c46c21abb fix rubocop Style/ColonMethodCall cop 2015-03-21 11:16:06 +03:00
Pavel.Lobashov bb08213cb7 fix rubocop Style/Alias cop 2015-03-20 23:17:05 +03:00