zip_tricks 5.1.0 → 5.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 983b83d36f88a25db8276a74e45d506f801ac3ecdd64197fd6fbc98bdb39cb03
4
- data.tar.gz: c74a8a3936f4afb1f71ad7775025b73ccd04d2db309df8942a20ff64e82cea81
3
+ metadata.gz: 311852db3fa83e4f6631fb8ecf563255c0f16a65bf2b3c2f2375f41040eb3661
4
+ data.tar.gz: e7b307a3b5eb5ed344d20c85d8d5cef40e89e9afbe61ce5dded2f3971b60002a
5
5
  SHA512:
6
- metadata.gz: 2b6eed391cd16c4077003535b0d7fb52e6930f351b230d31ba68aab2f05905df3987565aad76741083e888a91d054eaff3beab507117088b812b6c95f9ecf4f3
7
- data.tar.gz: 9c4ad53ef462d28f8cdffcc439200788cb260e9d1b35ee231aed3b7979630d0c31881db95198a944c375c836678063e0db187fbfb3c2672819ad5e06d1023dc9
6
+ metadata.gz: 031da6b3ab1199c8967f7cfbf0116beb9025346b10ae3679391f08c6c3205672842b1f38309efeb710af758c0c28a9c2ed0b5ce784936f3c3bfdb79b3920a3a2
7
+ data.tar.gz: 5e412daec62f191e4e54cfe8ff60127784264b0c851454db58b95b646af379a219d271e9d6d94aa00beb0d91b986960da07266940cc58764abb2e3e8892372b6
@@ -1,3 +1,9 @@
1
+ ## 5.1.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
  ## 5.1.0
2
8
 
3
9
  * Slightly rework `RemoteIO` and `RemoteUncap` and make sure they work correctly by spinning up a test webserver
@@ -25,16 +31,16 @@
25
31
 
26
32
  ## 4.7.4
27
33
 
28
- * Use a single fixed capacity string in StreamCRC32.from_io to avoid unnecessary allocations
34
+ * Use a single fixed capacity string in `StreamCRC32.from_io` to avoid unnecessary allocations
29
35
  * Fix a few tests that were calling out to external binaries
30
36
 
31
37
  ## 4.7.3
32
38
 
33
- * Fix RemoteUncap#request_object_size to function correctly
39
+ * Fix `RemoteUncap#request_object_size` to function correctly
34
40
 
35
41
  ## 4.7.2
36
42
 
37
- * Relax bundler dependency so that both 1.x and 2.x are supported cleanly
43
+ * Relax bundler dependency so that both bundler 1.x and 2.x are supported cleanly
38
44
 
39
45
  ## 4.7.1
40
46
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ZipTricks
4
- VERSION = '5.1.0'
4
+ VERSION = '5.1.1'
5
5
  end
@@ -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 << timestamp_extra(mtime)
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 << timestamp_extra(mtime)
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. The spec defines 2
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 timestamp_extra(mtime)
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 = 0b10000000 # Set bit 1 only to indicate only mtime is present
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 + 1 long used for the timestamp)
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
  #
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.require_paths = ['lib']
32
32
 
33
33
  spec.add_development_dependency 'bundler'
34
- spec.add_development_dependency 'rubyzip', '~> 1', '>= 1.2.2'
34
+ spec.add_development_dependency 'rubyzip', '~> 1'
35
35
  spec.add_development_dependency 'terminal-table'
36
36
  spec.add_development_dependency 'range_utils'
37
37
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zip_tricks
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 5.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik Tarkhanov
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2020-02-04 00:00:00.000000000 Z
14
+ date: 2020-05-07 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -34,9 +34,6 @@ dependencies:
34
34
  - - "~>"
35
35
  - !ruby/object:Gem::Version
36
36
  version: '1'
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: 1.2.2
40
37
  type: :development
41
38
  prerelease: false
42
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -44,9 +41,6 @@ dependencies:
44
41
  - - "~>"
45
42
  - !ruby/object:Gem::Version
46
43
  version: '1'
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: 1.2.2
50
44
  - !ruby/object:Gem::Dependency
51
45
  name: terminal-table
52
46
  requirement: !ruby/object:Gem::Requirement
@@ -298,7 +292,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
298
292
  - !ruby/object:Gem::Version
299
293
  version: '0'
300
294
  requirements: []
301
- rubygems_version: 3.0.6
295
+ rubygems_version: 3.0.3
302
296
  signing_key:
303
297
  specification_version: 4
304
298
  summary: Stream out ZIP files from Ruby