zip_tricks 4.8.0 → 4.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +6 -0
- data/lib/zip_tricks/version.rb +1 -1
- data/lib/zip_tricks/zip_writer.rb +13 -6
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: abccaae29c08d47d71a7c6709fbba2ccffce423798dbb159bbfdc9f832eafc93
|
4
|
+
data.tar.gz: ba5375f2fbd1617ffdf6c42ddd690f211e771c6eb4cb84c8a2e9323784acfd7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbd7498e71a1dbb967374a2360e2216ab33924ba263600f795e11787b759aa08c5b2ba3b5085bc4a8362026e87098f18552d0409e23ab03375cf0d89e8bd20d8
|
7
|
+
data.tar.gz: f337fba0f07875b449ba3b5f5a593b30b2b810ca2aa79b473942a751a47d1db4c0ebbbe099faa474fe4c7a952b1ee030f6f94ed319835a3ba73c1e7cf65648e5
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 4.8.1
|
2
|
+
|
3
|
+
* Fix extended timestamp extra field output. The first bit of the flag would be set instead of the last bit of
|
4
|
+
the flag, which made it impossible for Rubyzip to read the timestamp of the entry - and it would also make
|
5
|
+
the extra field useless for most reading applications.
|
6
|
+
|
1
7
|
## 4.8.0
|
2
8
|
|
3
9
|
* Make sure that when directories clobber files and vice versa we raise a clear error. Add `PathSet` which keeps track of entries
|
data/lib/zip_tricks/version.rb
CHANGED
@@ -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_for_local_file_header(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_for_central_directory_entry(mtime)
|
186
186
|
|
187
187
|
io << [extra_fields.size].pack(C_UINT2) # extra field length 2 bytes
|
188
188
|
|
@@ -345,12 +345,14 @@ class ZipTricks::ZipWriter
|
|
345
345
|
pack_array(data_and_packspecs)
|
346
346
|
end
|
347
347
|
|
348
|
-
# Writes the extended timestamp information field
|
348
|
+
# Writes the extended timestamp information field for local headers.
|
349
|
+
#
|
350
|
+
# The spec defines 2
|
349
351
|
# different formats - the one for the local file header can also accomodate the
|
350
352
|
# atime and ctime, whereas the one for the central directory can only take
|
351
353
|
# the mtime - and refers the reader to the local header extra to obtain the
|
352
354
|
# remaining times
|
353
|
-
def
|
355
|
+
def timestamp_extra_for_local_file_header(mtime)
|
354
356
|
# Local-header version:
|
355
357
|
#
|
356
358
|
# Value Size Description
|
@@ -378,16 +380,21 @@ class ZipTricks::ZipWriter
|
|
378
380
|
# bit 1 if set, access time is present
|
379
381
|
# bit 2 if set, creation time is present
|
380
382
|
# bits 3-7 reserved for additional timestamps; not set
|
381
|
-
flags =
|
383
|
+
flags = 0b00000001 # Set the lowest bit only, to indicate that only mtime is present
|
382
384
|
data_and_packspecs = [
|
383
385
|
0x5455, C_UINT2, # tag for this extra block type ("UT")
|
384
|
-
(1 + 4), C_UINT2, # the size of this block (1 byte used for the Flag +
|
386
|
+
(1 + 4), C_UINT2, # the size of this block (1 byte used for the Flag + 3 longs used for the timestamp)
|
385
387
|
flags, C_CHAR, # encode a single byte
|
386
388
|
mtime.utc.to_i, C_INT4, # Use a signed long, not the unsigned one used by the rest of the ZIP spec.
|
387
389
|
]
|
390
|
+
# The atime and ctime can be omitted if not present
|
388
391
|
pack_array(data_and_packspecs)
|
389
392
|
end
|
390
393
|
|
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
|
+
|
391
398
|
# Writes the Zip64 extra field for the central directory header.It differs from the extra used in the local file header because it
|
392
399
|
# also contains the location of the local file header in the ZIP as an 8-byte int.
|
393
400
|
#
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zip_tricks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.8.
|
4
|
+
version: 4.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julik Tarkhanov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -274,8 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
274
274
|
- !ruby/object:Gem::Version
|
275
275
|
version: '0'
|
276
276
|
requirements: []
|
277
|
-
|
278
|
-
rubygems_version: 2.6.11
|
277
|
+
rubygems_version: 3.0.3
|
279
278
|
signing_key:
|
280
279
|
specification_version: 4
|
281
280
|
summary: Stream out ZIP files from Ruby
|