zip_tricks 4.8.3 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -14
- data/LICENSE.txt +26 -2
- data/README.md +4 -2
- data/lib/zip_tricks/streamer.rb +3 -5
- data/lib/zip_tricks/streamer/deflated_writer.rb +0 -2
- data/lib/zip_tricks/version.rb +1 -1
- data/lib/zip_tricks/zip_writer.rb +8 -15
- data/zip_tricks.gemspec +2 -1
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 327b846ccfc7d19442d21e145a2f767da91f0547381afe52be27db6709dee4a4
|
4
|
+
data.tar.gz: 4d80718a715063f1cebad32471ab83e77d38a805f3ceed82793b922d0d3a877f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 982bc310eb658d67262c28efb043f1ddd3957db197ef1bcbe9108f3572431211069843221d36cf9b28231617d899249ad06be5b9c756189e8f0d383b168a340f
|
7
|
+
data.tar.gz: 40fdde09881e02b5a816dae826554e14d76fb26a1bcf09cfcd053450668b34e2d3c63dc5bbf84417b6bdc44f021a35d38fdabd08d9ace5aabe1ff6c335b65e49
|
data/CHANGELOG.md
CHANGED
@@ -1,17 +1,11 @@
|
|
1
|
-
##
|
2
|
-
|
3
|
-
*
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
## 4.8.1
|
11
|
-
|
12
|
-
* Fix extended timestamp extra field output. The first bit of the flag would be set instead of the last bit of
|
13
|
-
the flag, which made it impossible for Rubyzip to read the timestamp of the entry - and it would also make
|
14
|
-
the extra field useless for most reading applications.
|
1
|
+
## 5.0.0
|
2
|
+
|
3
|
+
* Disable automatic filename deduplication by default, because it does not play nice with file/directory
|
4
|
+
clobbering. The option can still be enabled by passing `auto_rename_duplicate_filenames: true` to the Streamer
|
5
|
+
and all modules that use it
|
6
|
+
* Adopt [Hippocratic license v. 1.2](https://firstdonoharm.dev/version/1/2/license.html)
|
7
|
+
Note that this might make the license conditions unacceptable for your project. If that is the case,
|
8
|
+
you can use the 4.x branch of the library which stays under the original, exact MIT license.
|
15
9
|
|
16
10
|
## 4.8.0
|
17
11
|
|
data/LICENSE.txt
CHANGED
@@ -8,8 +8,28 @@ distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
8
|
permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
the following conditions:
|
10
10
|
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
11
|
+
* The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
* No Harm: The software may not be used by anyone for systems or
|
15
|
+
activities that actively and knowingly endanger, harm, or otherwise
|
16
|
+
threaten the physical, mental, economic, or general well-being of
|
17
|
+
other individuals or groups, in violation of the United Nations
|
18
|
+
Universal Declaration of Human Rights
|
19
|
+
(https://www.un.org/en/universal-declaration-human-rights/).
|
20
|
+
|
21
|
+
* Services: If the Software is used to provide a service to others, the
|
22
|
+
licensee shall, as a condition of use, require those others not to use
|
23
|
+
the service in any way that violates the No Harm clause above.
|
24
|
+
|
25
|
+
* Enforceability: If any portion or provision of this License shall to
|
26
|
+
any extent be declared illegal or unenforceable by a court of
|
27
|
+
competent jurisdiction, then the remainder of this License, or the
|
28
|
+
application of such portion or provision in circumstances other than
|
29
|
+
those as to which it is so declared illegal or unenforceable, shall
|
30
|
+
not be affected thereby, and each portion and provision of this
|
31
|
+
Agreement shall be valid and enforceable to the fullest extent
|
32
|
+
permitted by law.
|
13
33
|
|
14
34
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
35
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
@@ -18,3 +38,7 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
38
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
39
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
40
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
41
|
+
|
42
|
+
This Hippocratic License is an Ethical Source license
|
43
|
+
(https://ethicalsource.dev) derived from the MIT License, amended to
|
44
|
+
limit the impact of the unethical use of open source software.
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# zip_tricks
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/WeTransfer/zip_tricks.svg?branch=
|
3
|
+
[![Build Status](https://travis-ci.org/WeTransfer/zip_tricks.svg?branch=master)](https://travis-ci.org/WeTransfer/zip_tricks)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/zip_tricks.svg)](https://badge.fury.io/rb/zip_tricks)
|
4
5
|
|
5
6
|
Allows streaming, non-rewinding ZIP file output from Ruby.
|
6
7
|
|
@@ -177,4 +178,5 @@ that have not been formally verified (ours hasn't been).
|
|
177
178
|
|
178
179
|
## Copyright
|
179
180
|
|
180
|
-
Copyright (c) 2019 WeTransfer.
|
181
|
+
Copyright (c) 2019 WeTransfer. `zip_tricks` is distributed under the conditions of the [Hippocratic License](https://firstdonoharm.dev/version/1/2/license.html)
|
182
|
+
- See LICENSE.txt for further details.
|
data/lib/zip_tricks/streamer.rb
CHANGED
@@ -141,11 +141,9 @@ class ZipTricks::Streamer
|
|
141
141
|
# @param writer[ZipTricks::ZipWriter] the object to be used as the writer.
|
142
142
|
# Defaults to an instance of ZipTricks::ZipWriter, normally you won't need to override it
|
143
143
|
# @param auto_rename_duplicate_filenames[Boolean] whether duplicate filenames, when encountered,
|
144
|
-
# should be suffixed with (1), (2) etc. Default value is `
|
145
|
-
# used
|
146
|
-
|
147
|
-
# **DEPRECATION NOTICE** In ZipTricks version 5 `auto_rename_duplicate_filenames` will default to `false`
|
148
|
-
def initialize(stream, writer: create_writer, auto_rename_duplicate_filenames: true)
|
144
|
+
# should be suffixed with (1), (2) etc. Default value is `false` - if
|
145
|
+
# dupliate names are used an exception will be raised
|
146
|
+
def initialize(stream, writer: create_writer, auto_rename_duplicate_filenames: false)
|
149
147
|
raise InvalidOutput, 'The stream must respond to #<<' unless stream.respond_to?(:<<)
|
150
148
|
|
151
149
|
@dedupe_filenames = auto_rename_duplicate_filenames
|
@@ -50,8 +50,6 @@ class ZipTricks::Streamer::DeflatedWriter
|
|
50
50
|
def finish
|
51
51
|
@compressed_io << @deflater.finish until @deflater.finished?
|
52
52
|
{crc32: @crc.to_i, compressed_size: @compressed_io.tell, uncompressed_size: @uncompressed_size}
|
53
|
-
ensure
|
54
|
-
@deflater.close
|
55
53
|
end
|
56
54
|
|
57
55
|
private
|
data/lib/zip_tricks/version.rb
CHANGED
@@ -57,7 +57,7 @@ class ZipTricks::ZipWriter
|
|
57
57
|
C_UINT2 = 'v' # Encode a 2-byte unsigned little-endian uint
|
58
58
|
C_UINT8 = 'Q<' # Encode an 8-byte unsigned little-endian uint
|
59
59
|
C_CHAR = 'C' # For bit-encoded strings
|
60
|
-
C_INT4 = '
|
60
|
+
C_INT4 = 'N' # Encode a 4-byte signed little-endian int
|
61
61
|
|
62
62
|
private_constant :FOUR_BYTE_MAX_UINT,
|
63
63
|
:TWO_BYTE_MAX_UINT,
|
@@ -118,7 +118,7 @@ class ZipTricks::ZipWriter
|
|
118
118
|
if requires_zip64
|
119
119
|
extra_fields << zip_64_extra_for_local_file_header(compressed_size: compressed_size, uncompressed_size: uncompressed_size)
|
120
120
|
end
|
121
|
-
extra_fields <<
|
121
|
+
extra_fields << timestamp_extra(mtime)
|
122
122
|
|
123
123
|
io << [extra_fields.size].pack(C_UINT2) # extra field length 2 bytes
|
124
124
|
|
@@ -182,7 +182,7 @@ class ZipTricks::ZipWriter
|
|
182
182
|
compressed_size: compressed_size,
|
183
183
|
uncompressed_size: uncompressed_size)
|
184
184
|
end
|
185
|
-
extra_fields <<
|
185
|
+
extra_fields << timestamp_extra(mtime)
|
186
186
|
|
187
187
|
io << [extra_fields.size].pack(C_UINT2) # extra field length 2 bytes
|
188
188
|
|
@@ -345,14 +345,12 @@ class ZipTricks::ZipWriter
|
|
345
345
|
pack_array(data_and_packspecs)
|
346
346
|
end
|
347
347
|
|
348
|
-
# Writes the extended timestamp information field
|
349
|
-
#
|
350
|
-
# The spec defines 2
|
348
|
+
# Writes the extended timestamp information field. The spec defines 2
|
351
349
|
# different formats - the one for the local file header can also accomodate the
|
352
350
|
# atime and ctime, whereas the one for the central directory can only take
|
353
351
|
# the mtime - and refers the reader to the local header extra to obtain the
|
354
352
|
# remaining times
|
355
|
-
def
|
353
|
+
def timestamp_extra(mtime)
|
356
354
|
# Local-header version:
|
357
355
|
#
|
358
356
|
# Value Size Description
|
@@ -380,21 +378,16 @@ class ZipTricks::ZipWriter
|
|
380
378
|
# bit 1 if set, access time is present
|
381
379
|
# bit 2 if set, creation time is present
|
382
380
|
# bits 3-7 reserved for additional timestamps; not set
|
383
|
-
flags =
|
381
|
+
flags = 0b10000000 # Set bit 1 only to indicate only mtime is present
|
384
382
|
data_and_packspecs = [
|
385
383
|
0x5455, C_UINT2, # tag for this extra block type ("UT")
|
386
|
-
(1 + 4), C_UINT2, # the size of this block (1 byte used for the Flag +
|
384
|
+
(1 + 4), C_UINT2, # the size of this block (1 byte used for the Flag + 1 long used for the timestamp)
|
387
385
|
flags, C_CHAR, # encode a single byte
|
388
|
-
mtime.utc.to_i, C_INT4, # Use a signed
|
386
|
+
mtime.utc.to_i, C_INT4, # Use a signed long, not the unsigned one used by the rest of the ZIP spec.
|
389
387
|
]
|
390
|
-
# The atime and ctime can be omitted if not present
|
391
388
|
pack_array(data_and_packspecs)
|
392
389
|
end
|
393
390
|
|
394
|
-
# Since we do not supply atime or ctime, the contents of the two extra fields (central dir and local header)
|
395
|
-
# is exactly the same, so we can use a method alias.
|
396
|
-
alias_method :timestamp_extra_for_central_directory_entry, :timestamp_extra_for_local_file_header
|
397
|
-
|
398
391
|
# Writes the Zip64 extra field for the central directory header.It differs from the extra used in the local file header because it
|
399
392
|
# also contains the location of the local file header in the ZIP as an 8-byte int.
|
400
393
|
#
|
data/zip_tricks.gemspec
CHANGED
@@ -5,9 +5,10 @@ require 'zip_tricks/version'
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'zip_tricks'
|
7
7
|
spec.version = ZipTricks::VERSION
|
8
|
-
spec.authors = ['Julik Tarkhanov']
|
8
|
+
spec.authors = ['Julik Tarkhanov', 'Noah Berman', 'Dmitry Tymchuk', 'David Bosveld']
|
9
9
|
spec.email = ['me@julik.nl']
|
10
10
|
|
11
|
+
spec.licenses = ['MIT (Hippocratic)']
|
11
12
|
spec.summary = 'Stream out ZIP files from Ruby'
|
12
13
|
spec.description = 'Stream out ZIP files from Ruby'
|
13
14
|
spec.homepage = 'http://github.com/wetransfer/zip_tricks'
|
metadata
CHANGED
@@ -1,14 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zip_tricks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julik Tarkhanov
|
8
|
+
- Noah Berman
|
9
|
+
- Dmitry Tymchuk
|
10
|
+
- David Bosveld
|
8
11
|
autorequire:
|
9
12
|
bindir: exe
|
10
13
|
cert_chain: []
|
11
|
-
date:
|
14
|
+
date: 2019-11-01 00:00:00.000000000 Z
|
12
15
|
dependencies:
|
13
16
|
- !ruby/object:Gem::Dependency
|
14
17
|
name: bundler
|
@@ -256,7 +259,8 @@ files:
|
|
256
259
|
- qa/test-report.txt
|
257
260
|
- zip_tricks.gemspec
|
258
261
|
homepage: http://github.com/wetransfer/zip_tricks
|
259
|
-
licenses:
|
262
|
+
licenses:
|
263
|
+
- MIT (Hippocratic)
|
260
264
|
metadata:
|
261
265
|
allowed_push_host: https://rubygems.org
|
262
266
|
post_install_message:
|
@@ -274,7 +278,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
274
278
|
- !ruby/object:Gem::Version
|
275
279
|
version: '0'
|
276
280
|
requirements: []
|
277
|
-
rubygems_version: 3.
|
281
|
+
rubygems_version: 3.0.6
|
278
282
|
signing_key:
|
279
283
|
specification_version: 4
|
280
284
|
summary: Stream out ZIP files from Ruby
|