rubyzip 3.4.1 → 3.5.0

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: d47a342ee6f01bc44287aadc88dcb89f5c77b9cb0908a7e4424fe6c04efda6f8
4
- data.tar.gz: 59946a6e6fa379eb995646b20125584b29dd5024932b73c7e252fb77fa521ba6
3
+ metadata.gz: 127a7ca4438d6d96f18b7f9699d47491e416ddcc6dbcc0bc8f83f8335a2d516c
4
+ data.tar.gz: f305dbf4d5f909f1218f11c9400cf41b5645a20233ccdfec8b4416a533d558de
5
5
  SHA512:
6
- metadata.gz: 6e2fe52d5643d587ed1cfdc8170ec3186f1dbdde20f8bf69d7cc3701787b262128b53fca1758f96efe10426a63bc11e878d45e70f9a8896e5e3acbe29e00b000
7
- data.tar.gz: 7baf6d1354b43891fed64ebaf29e060f8afecf4576fd3c8bc5dd73ee72cdfaa4686fddac9bfb6561ccdb5b3eecbcc65c7780e36be2d77eed11b8cff455637ebb
6
+ metadata.gz: c7aaa339ad47862c661b1f284cb1bd38ae65583fb623b85307e20b79f3d871fb3d87254b3a183aee3ba52a16cf8865ed88118919f8997d966384a60c98141234
7
+ data.tar.gz: d19bb9446945b5d5612e2b3c10dff6727f32d638fe738829ac7bcf5929d20e429683e76a3cc84543ae607c6e2d3941fcf104357e9d3d52670e0547667e43c849
data/Changelog.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 3.5.0 (2026-08-18)
2
+
3
+ - Fix the link to Ruby doc in README to the latest version. [#670](https://github.com/rubyzip/rubyzip/pull/670)
4
+ - Support passing decrypter to encrypted entry via get_input_stream. [#667](https://github.com/rubyzip/rubyzip/pull/667)
5
+
1
6
  # 3.4.1 (2026-06-27)
2
7
 
3
8
  - Fixed `DecryptedIo` to only perform integrity once. [#665](https://github.com/rubyzip/rubyzip/pull/665)
data/README.md CHANGED
@@ -201,7 +201,7 @@ On Posix file systems the default file permissions applied to a new archive
201
201
  are (0666 - umask), which mimics the behavior of standard tools such as `touch`.
202
202
 
203
203
  On Windows the default file permissions are set to 0644 as suggested by the
204
- [Ruby File documentation](http://ruby-doc.org/core-2.2.2/File.html).
204
+ [Ruby File documentation](https://docs.ruby-lang.org/en/master/File.html#class-file-file-permissions).
205
205
 
206
206
  When modifying a zip archive the file permissions of the archive are preserved.
207
207
 
@@ -301,6 +301,25 @@ Zip::InputStream.open(buffer, decrypter: dec) do |input|
301
301
  end
302
302
  ```
303
303
 
304
+ #### Passing a decrypter to an individual `Entry`
305
+
306
+ You can also decrypt an `Entry` by passing a decrypter into `Zip::Entry#get_input_stream`. This allows you to decrypt files from a Zip file with different passwords.
307
+
308
+ ```ruby
309
+ Zip::File.open('aes-encrypted-file.zip') do |zip|
310
+ entries = [['file1.txt', 'password1'], ['file2.txt', 'password2']]
311
+
312
+ entries.each do |entry_name, password|
313
+ entry = zip.find_entry(entry_name)
314
+ dec = Zip::AESDecrypter.new(password, Zip::AESEncryption::STRENGTH_256_BIT)
315
+ zis = entry.get_input_stream(decrypter: dec)
316
+
317
+ puts "Contents of '#{entry.name}':"
318
+ puts zis.read
319
+ end
320
+ end
321
+ ```
322
+
304
323
  _This is an evolving feature and the interface for encryption may change in future versions._
305
324
 
306
325
  ## Known issues
@@ -348,7 +367,7 @@ Zip.continue_on_exists_proc = true
348
367
 
349
368
  ### Non-ASCII Names
350
369
 
351
- If you want to store non-english names and want to open them on Windows(pre 7) you need to set this option:
370
+ To store non-English filenames as UTF-8 (decoded correctly by Windows 7 or later and other modern tools), set this option:
352
371
 
353
372
  ```ruby
354
373
  Zip.unicode_names = true
data/lib/zip/entry.rb CHANGED
@@ -638,8 +638,9 @@ module Zip
638
638
  end
639
639
 
640
640
  # Returns an IO like object for the given ZipEntry.
641
+ # Optional decrypter can be provided for an encrypted entry
641
642
  # Warning: may behave weird with symlinks.
642
- def get_input_stream(&block)
643
+ def get_input_stream(decrypter: nil, &block)
643
644
  if ftype == :directory
644
645
  yield ::Zip::NullInputStream if block
645
646
  ::Zip::NullInputStream
@@ -656,7 +657,7 @@ module Zip
656
657
  raise "unknown @file_type #{ftype}"
657
658
  end
658
659
  else
659
- zis = ::Zip::InputStream.new(@zipfile, offset: local_header_offset)
660
+ zis = ::Zip::InputStream.new(@zipfile, offset: local_header_offset, decrypter: decrypter)
660
661
  zis.instance_variable_set(:@complete_entry, self)
661
662
  zis.get_next_entry
662
663
  if block
data/lib/zip/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Zip
4
4
  # The version of the Rubyzip library.
5
- VERSION = '3.4.1'
5
+ VERSION = '3.5.0'
6
6
  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.4.1
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Haines
@@ -196,9 +196,9 @@ licenses:
196
196
  - BSD-2-Clause
197
197
  metadata:
198
198
  bug_tracker_uri: https://github.com/rubyzip/rubyzip/issues
199
- changelog_uri: https://github.com/rubyzip/rubyzip/blob/v3.4.1/Changelog.md
200
- documentation_uri: https://www.rubydoc.info/gems/rubyzip/3.4.1
201
- source_code_uri: https://github.com/rubyzip/rubyzip/tree/v3.4.1
199
+ changelog_uri: https://github.com/rubyzip/rubyzip/blob/v3.5.0/Changelog.md
200
+ documentation_uri: https://www.rubydoc.info/gems/rubyzip/3.5.0
201
+ source_code_uri: https://github.com/rubyzip/rubyzip/tree/v3.5.0
202
202
  wiki_uri: https://github.com/rubyzip/rubyzip/wiki
203
203
  rubygems_mfa_required: 'true'
204
204
  rdoc_options: []
@@ -215,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
215
215
  - !ruby/object:Gem::Version
216
216
  version: '0'
217
217
  requirements: []
218
- rubygems_version: 3.7.2
218
+ rubygems_version: 4.0.17
219
219
  specification_version: 4
220
220
  summary: rubyzip is a ruby module for reading and writing zip files
221
221
  test_files: []