rubyzip 3.0.0.rc1 → 3.0.0.rc2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2840381c70e4bc8b3fbbfc003e4caf71dab05301621a411b44dc16cd962ca4fb
4
- data.tar.gz: 75199ebb2cf53b8a53b930a0ef908773328b4cab2dadef4839fe8194fced289c
3
+ metadata.gz: 7a2a18261870066289dfb751472f788cf6cc3cecb119b14ddfe33b982823215e
4
+ data.tar.gz: 96db40d3eb0b9bd9ad96ae51c3f9ec0ca1fa290352aefd969c03a558c4f9dbe7
5
5
  SHA512:
6
- metadata.gz: 1716ef6a03ee08773e4dba640be0fe0e294e4a955b2535d5049dd62c37cc82e161827c2e226c9b93c883f6789c9f275d30e267733038aee59e2c4a80f55193e1
7
- data.tar.gz: b4b320f64167dd5f464e45d61d49b2e49619bc356cd2d59f617dfd8ebe7a1be5724e294bab2498186dde951cfd7453a5a4b09f15fd6f88f9872234956182241a
6
+ metadata.gz: e6dde3c07ee1a5949996cce233db30b51d96b5c3947ce590b1677bf6bb69f62a155253615b2c44d63af77264e0cbaf5c3be7e16996b6ad27674a5ac307fb1d0a
7
+ data.tar.gz: bf6b290da9be2332de71fe6ba13ba5491d3c4bdfdd92f67b7276790bce535195950631071ba96d02e0800b030bf8332020b96c93effe35a03287b63ad7f94400
data/Changelog.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # 3.0.0 (Next)
2
2
 
3
+ - Fix de facto regression for input streams.
3
4
  - Fix `File#write_buffer` to always return the given `io`.
4
5
  - Add `Entry#absolute_time?` and `DOSTime#absolute_time?` methods.
5
6
  - Use explicit named parameters for `File` methods.
@@ -39,6 +40,7 @@
39
40
 
40
41
  Tooling/internal:
41
42
 
43
+ - Add a test to ensure correct version number format.
42
44
  - Update the README with new Ruby version compatability information.
43
45
  - Fix various issues with JRuby tests.
44
46
  - Update gem dependency versions.
data/lib/zip/entry.rb CHANGED
@@ -113,7 +113,7 @@ module Zip
113
113
  end
114
114
 
115
115
  def incomplete? # :nodoc:
116
- gp_flags & 8 == 8
116
+ (gp_flags & 8 == 8) && (crc == 0 || size == 0 || compressed_size == 0)
117
117
  end
118
118
 
119
119
  # The uncompressed size of the entry.
@@ -343,24 +343,25 @@ module Zip
343
343
 
344
344
  def read_local_entry(io) # :nodoc:
345
345
  @dirty = false # No changes at this point.
346
- @local_header_offset = io.tell
346
+ current_offset = io.tell
347
347
 
348
- static_sized_fields_buf = io.read(::Zip::LOCAL_ENTRY_STATIC_HEADER_LENGTH) || ''
348
+ read_local_header_fields(io)
349
349
 
350
- unless static_sized_fields_buf.bytesize == ::Zip::LOCAL_ENTRY_STATIC_HEADER_LENGTH
351
- raise Error, 'Premature end of file. Not enough data for zip entry local header'
352
- end
350
+ if @header_signature == SPLIT_FILE_SIGNATURE
351
+ raise SplitArchiveError if current_offset.zero?
353
352
 
354
- unpack_local_entry(static_sized_fields_buf)
353
+ # Rewind, skipping the data descriptor, then try to read the local header again.
354
+ current_offset += 16
355
+ io.seek(current_offset)
356
+ read_local_header_fields(io)
357
+ end
355
358
 
356
359
  unless @header_signature == LOCAL_ENTRY_SIGNATURE
357
- if @header_signature == SPLIT_FILE_SIGNATURE
358
- raise SplitArchiveError
359
- end
360
-
361
- raise Error, "Zip local header magic not found at location '#{local_header_offset}'"
360
+ raise Error, "Zip local header magic not found at location '#{current_offset}'"
362
361
  end
363
362
 
363
+ @local_header_offset = current_offset
364
+
364
365
  set_time(@last_mod_date, @last_mod_time)
365
366
 
366
367
  @name = io.read(@name_length)
@@ -721,6 +722,16 @@ module Zip
721
722
 
722
723
  private
723
724
 
725
+ def read_local_header_fields(io) # :nodoc:
726
+ static_sized_fields_buf = io.read(::Zip::LOCAL_ENTRY_STATIC_HEADER_LENGTH) || ''
727
+
728
+ unless static_sized_fields_buf.bytesize == ::Zip::LOCAL_ENTRY_STATIC_HEADER_LENGTH
729
+ raise Error, 'Premature end of file. Not enough data for zip entry local header'
730
+ end
731
+
732
+ unpack_local_entry(static_sized_fields_buf)
733
+ end
734
+
724
735
  def set_time(binary_dos_date, binary_dos_time)
725
736
  @time = ::Zip::DOSTime.parse_binary_dos_format(binary_dos_date, binary_dos_time)
726
737
  rescue ArgumentError
data/lib/zip/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Zip
4
- VERSION = '3.0.0.rc1' # :nodoc:
4
+ VERSION = '3.0.0.rc2' # :nodoc:
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyzip
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.rc1
4
+ version: 3.0.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Haines
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2025-01-26 00:00:00.000000000 Z
13
+ date: 2025-02-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: minitest
@@ -195,9 +195,9 @@ licenses:
195
195
  - BSD-2-Clause
196
196
  metadata:
197
197
  bug_tracker_uri: https://github.com/rubyzip/rubyzip/issues
198
- changelog_uri: https://github.com/rubyzip/rubyzip/blob/v3.0.0.rc1/Changelog.md
199
- documentation_uri: https://www.rubydoc.info/gems/rubyzip/3.0.0.rc1
200
- source_code_uri: https://github.com/rubyzip/rubyzip/tree/v3.0.0.rc1
198
+ changelog_uri: https://github.com/rubyzip/rubyzip/blob/v3.0.0.rc2/Changelog.md
199
+ documentation_uri: https://www.rubydoc.info/gems/rubyzip/3.0.0.rc2
200
+ source_code_uri: https://github.com/rubyzip/rubyzip/tree/v3.0.0.rc2
201
201
  wiki_uri: https://github.com/rubyzip/rubyzip/wiki
202
202
  rubygems_mfa_required: 'true'
203
203
  post_install_message: