rubyzip 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rubyzip might be problematic. Click here for more details.

Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/lib/zip/file.rb +2 -1
  3. data/lib/zip/inflater.rb +15 -44
  4. data/lib/zip/ioextras/abstract_input_stream.rb +5 -1
  5. data/lib/zip/version.rb +1 -1
  6. data/test/alltests.rb +18 -0
  7. data/test/basic_zip_file_test.rb +64 -0
  8. data/test/central_directory_entry_test.rb +73 -0
  9. data/test/central_directory_test.rb +100 -0
  10. data/test/data/file1.txt +46 -0
  11. data/test/data/file1.txt.deflatedData +0 -0
  12. data/test/data/file2.txt +1504 -0
  13. data/test/data/file2.txt.other +0 -0
  14. data/test/data/globTest.zip +0 -0
  15. data/test/data/globTest/foo.txt +0 -0
  16. data/test/data/globTest/foo/bar/baz/foo.txt +0 -0
  17. data/test/data/globTest/food.txt +0 -0
  18. data/test/data/mimetype +1 -0
  19. data/test/data/notzippedruby.rb +7 -0
  20. data/test/data/rubycode.zip +0 -0
  21. data/test/data/rubycode2.zip +0 -0
  22. data/test/data/testDirectory.bin +0 -0
  23. data/test/data/zip64-sample.zip +0 -0
  24. data/test/data/zipWithDirs.zip +0 -0
  25. data/test/deflater_test.rb +62 -0
  26. data/test/dummy.txt +1 -0
  27. data/test/entry_set_test.rb +125 -0
  28. data/test/entry_test.rb +165 -0
  29. data/test/errors_test.rb +36 -0
  30. data/test/extra_field_test.rb +69 -0
  31. data/test/file_extract_directory_test.rb +55 -0
  32. data/test/file_extract_test.rb +90 -0
  33. data/test/file_split_test.rb +60 -0
  34. data/test/file_test.rb +568 -0
  35. data/test/filesystem/dir_iterator_test.rb +62 -0
  36. data/test/filesystem/directory_test.rb +131 -0
  37. data/test/filesystem/file_mutating_test.rb +100 -0
  38. data/test/filesystem/file_nonmutating_test.rb +505 -0
  39. data/test/filesystem/file_stat_test.rb +66 -0
  40. data/test/gentestfiles.rb +134 -0
  41. data/test/inflater_test.rb +14 -0
  42. data/test/input_stream_test.rb +170 -0
  43. data/test/ioextras/abstract_input_stream_test.rb +103 -0
  44. data/test/ioextras/abstract_output_stream_test.rb +106 -0
  45. data/test/ioextras/fake_io_test.rb +18 -0
  46. data/test/ioextrastest.rb +233 -0
  47. data/test/local_entry_test.rb +153 -0
  48. data/test/odt_test_fix.rb +30 -0
  49. data/test/output_stream_test.rb +114 -0
  50. data/test/pass_thru_compressor_test.rb +31 -0
  51. data/test/pass_thru_decompressor_test.rb +15 -0
  52. data/test/sample.odt +0 -0
  53. data/test/settings_test.rb +71 -0
  54. data/test/test_helper.rb +228 -0
  55. data/test/unicode_file_names_and_comments_test.rb +40 -0
  56. data/test/zip64_full_test.rb +49 -0
  57. data/test/zip64_support_test.rb +15 -0
  58. metadata +107 -3
@@ -0,0 +1,40 @@
1
+ # encoding: utf-8
2
+
3
+ require 'test_helper'
4
+
5
+ class ZipUnicodeFileNamesAndComments < MiniTest::Unit::TestCase
6
+
7
+ FILENAME = File.join(File.dirname(__FILE__), "test1.zip")
8
+
9
+ def test_unicode
10
+ file_entrys = ["текстовыйфайл.txt", "Résumé.txt", "슬레이어스휘.txt"]
11
+ directory_entrys = ["папка/текстовыйфайл.txt", "Résumé/Résumé.txt", "슬레이어스휘/슬레이어스휘.txt"]
12
+ stream = ::Zip::OutputStream.open(FILENAME) do |io|
13
+ file_entrys.each do |filename|
14
+ io.put_next_entry(filename)
15
+ io.write(filename)
16
+ end
17
+ directory_entrys.each do |filepath|
18
+ io.put_next_entry(filepath)
19
+ io.write(filepath)
20
+ end
21
+ end
22
+ assert(!stream.nil?)
23
+ ::Zip::InputStream.open(FILENAME) do |io|
24
+ file_entrys.each do |filename|
25
+ entry = io.get_next_entry
26
+ entry_name = entry.name
27
+ entry_name = entry_name.force_encoding("UTF-8") if RUBY_VERSION >= '1.9'
28
+ assert(filename == entry_name)
29
+ end
30
+ directory_entrys.each do |filepath|
31
+ entry = io.get_next_entry
32
+ entry_name = entry.name
33
+ entry_name = entry_name.force_encoding("UTF-8") if RUBY_VERSION >= '1.9'
34
+ assert(filepath == entry_name)
35
+ end
36
+ end
37
+ ::File.unlink(FILENAME)
38
+ end
39
+
40
+ end
@@ -0,0 +1,49 @@
1
+ if ENV['FULL_ZIP64_TEST']
2
+ require 'minitest/autorun'
3
+ require 'minitest/unit'
4
+ require 'fileutils'
5
+ require 'zip'
6
+
7
+ # test zip64 support for real, by actually exceeding the 32-bit size/offset limits
8
+ # this test does not, of course, run with the normal unit tests! ;)
9
+
10
+ class Zip64FullTest < MiniTest::Unit::TestCase
11
+ def prepareTestFile(test_filename)
12
+ ::File.delete(test_filename) if ::File.exist?(test_filename)
13
+ return test_filename
14
+ end
15
+
16
+ def test_largeZipFile
17
+ ::Zip.write_zip64_support = true
18
+ first_text = 'starting out small'
19
+ last_text = 'this tests files starting after 4GB in the archive'
20
+ test_filename = prepareTestFile('huge.zip')
21
+ ::Zip::OutputStream.open(test_filename) do |io|
22
+ io.put_next_entry('first_file.txt')
23
+ io.write(first_text)
24
+
25
+ # write just over 4GB (stored, so the zip file exceeds 4GB)
26
+ buf = 'blah' * 16384
27
+ io.put_next_entry('huge_file', nil, nil, ::Zip::Entry::STORED)
28
+ 65537.times { io.write(buf) }
29
+
30
+ io.put_next_entry('last_file.txt')
31
+ io.write(last_text)
32
+ end
33
+
34
+ ::Zip::File.open(test_filename) do |zf|
35
+ assert_equal %w(first_file.txt huge_file last_file.txt), zf.entries.map(&:name)
36
+ assert_equal first_text, zf.read('first_file.txt')
37
+ assert_equal last_text, zf.read('last_file.txt')
38
+ end
39
+
40
+ # note: if this fails, be sure you have UnZip version 6.0 or newer
41
+ # as this is the first version to support zip64 extensions
42
+ # but some OSes (*cough* OSX) still bundle a 5.xx release
43
+ assert system("unzip -t #{test_filename}"), "third-party zip validation failed"
44
+ end
45
+
46
+ end
47
+
48
+ end
49
+
@@ -0,0 +1,15 @@
1
+ require 'test_helper'
2
+
3
+ class Zip64SupportTest < MiniTest::Unit::TestCase
4
+ TEST_FILE = File.join(File.dirname(__FILE__), 'data', 'zip64-sample.zip')
5
+
6
+ def test_open_zip64_file
7
+ zip_file = ::Zip::File.open(TEST_FILE)
8
+ assert(!zip_file.nil?)
9
+ assert(zip_file.entries.count == 2)
10
+ test_rb = zip_file.entries.find { |x| x.name == 'test.rb' }
11
+ assert(test_rb.size == 482)
12
+ assert(test_rb.compressed_size == 229)
13
+ end
14
+
15
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyzip
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Simonov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-30 00:00:00.000000000 Z
11
+ date: 2014-07-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -60,6 +60,58 @@ files:
60
60
  - README.md
61
61
  - TODO
62
62
  - Rakefile
63
+ - test/alltests.rb
64
+ - test/basic_zip_file_test.rb
65
+ - test/central_directory_entry_test.rb
66
+ - test/central_directory_test.rb
67
+ - test/data/file1.txt
68
+ - test/data/file1.txt.deflatedData
69
+ - test/data/file2.txt
70
+ - test/data/file2.txt.other
71
+ - test/data/globTest/foo/bar/baz/foo.txt
72
+ - test/data/globTest/foo.txt
73
+ - test/data/globTest/food.txt
74
+ - test/data/globTest.zip
75
+ - test/data/mimetype
76
+ - test/data/notzippedruby.rb
77
+ - test/data/rubycode.zip
78
+ - test/data/rubycode2.zip
79
+ - test/data/testDirectory.bin
80
+ - test/data/zip64-sample.zip
81
+ - test/data/zipWithDirs.zip
82
+ - test/deflater_test.rb
83
+ - test/dummy.txt
84
+ - test/entry_set_test.rb
85
+ - test/entry_test.rb
86
+ - test/errors_test.rb
87
+ - test/extra_field_test.rb
88
+ - test/file_extract_directory_test.rb
89
+ - test/file_extract_test.rb
90
+ - test/file_split_test.rb
91
+ - test/file_test.rb
92
+ - test/filesystem/dir_iterator_test.rb
93
+ - test/filesystem/directory_test.rb
94
+ - test/filesystem/file_mutating_test.rb
95
+ - test/filesystem/file_nonmutating_test.rb
96
+ - test/filesystem/file_stat_test.rb
97
+ - test/gentestfiles.rb
98
+ - test/inflater_test.rb
99
+ - test/input_stream_test.rb
100
+ - test/ioextras/abstract_input_stream_test.rb
101
+ - test/ioextras/abstract_output_stream_test.rb
102
+ - test/ioextras/fake_io_test.rb
103
+ - test/ioextrastest.rb
104
+ - test/local_entry_test.rb
105
+ - test/odt_test_fix.rb
106
+ - test/output_stream_test.rb
107
+ - test/pass_thru_compressor_test.rb
108
+ - test/pass_thru_decompressor_test.rb
109
+ - test/sample.odt
110
+ - test/settings_test.rb
111
+ - test/test_helper.rb
112
+ - test/unicode_file_names_and_comments_test.rb
113
+ - test/zip64_full_test.rb
114
+ - test/zip64_support_test.rb
63
115
  homepage: http://github.com/rubyzip/rubyzip
64
116
  licenses:
65
117
  - BSD 2-Clause
@@ -84,4 +136,56 @@ rubygems_version: 2.0.6
84
136
  signing_key:
85
137
  specification_version: 4
86
138
  summary: rubyzip is a ruby module for reading and writing zip files
87
- test_files: []
139
+ test_files:
140
+ - test/alltests.rb
141
+ - test/basic_zip_file_test.rb
142
+ - test/central_directory_entry_test.rb
143
+ - test/central_directory_test.rb
144
+ - test/data/file1.txt
145
+ - test/data/file1.txt.deflatedData
146
+ - test/data/file2.txt
147
+ - test/data/file2.txt.other
148
+ - test/data/globTest/foo/bar/baz/foo.txt
149
+ - test/data/globTest/foo.txt
150
+ - test/data/globTest/food.txt
151
+ - test/data/globTest.zip
152
+ - test/data/mimetype
153
+ - test/data/notzippedruby.rb
154
+ - test/data/rubycode.zip
155
+ - test/data/rubycode2.zip
156
+ - test/data/testDirectory.bin
157
+ - test/data/zip64-sample.zip
158
+ - test/data/zipWithDirs.zip
159
+ - test/deflater_test.rb
160
+ - test/dummy.txt
161
+ - test/entry_set_test.rb
162
+ - test/entry_test.rb
163
+ - test/errors_test.rb
164
+ - test/extra_field_test.rb
165
+ - test/file_extract_directory_test.rb
166
+ - test/file_extract_test.rb
167
+ - test/file_split_test.rb
168
+ - test/file_test.rb
169
+ - test/filesystem/dir_iterator_test.rb
170
+ - test/filesystem/directory_test.rb
171
+ - test/filesystem/file_mutating_test.rb
172
+ - test/filesystem/file_nonmutating_test.rb
173
+ - test/filesystem/file_stat_test.rb
174
+ - test/gentestfiles.rb
175
+ - test/inflater_test.rb
176
+ - test/input_stream_test.rb
177
+ - test/ioextras/abstract_input_stream_test.rb
178
+ - test/ioextras/abstract_output_stream_test.rb
179
+ - test/ioextras/fake_io_test.rb
180
+ - test/ioextrastest.rb
181
+ - test/local_entry_test.rb
182
+ - test/odt_test_fix.rb
183
+ - test/output_stream_test.rb
184
+ - test/pass_thru_compressor_test.rb
185
+ - test/pass_thru_decompressor_test.rb
186
+ - test/sample.odt
187
+ - test/settings_test.rb
188
+ - test/test_helper.rb
189
+ - test/unicode_file_names_and_comments_test.rb
190
+ - test/zip64_full_test.rb
191
+ - test/zip64_support_test.rb