Skip to content

Commit d44b5c4

Browse files
committed
Support RubyZip 3.
1 parent 7e9af2f commit d44b5c4

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

lib/spatial_features/unzip.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,17 @@ def self.extract(file_path, tmpdir: nil, downcase: false)
2121
[].tap do |paths|
2222
entries(file_path).each do |entry|
2323
next if entry.name =~ IGNORED_ENTRY_PATHS
24+
2425
output_filename = entry.name
2526
output_filename = output_filename.downcase if downcase
27+
2628
path = "#{tmpdir}/#{output_filename}"
27-
FileUtils.mkdir_p(File.dirname(path))
28-
entry.extract(path)
29+
directory = File.dirname(path)
30+
basename = File.basename(path)
31+
32+
FileUtils.mkdir_p(directory)
33+
entry.extract(basename, destination_directory: directory)
34+
2935
paths << path
3036
end
3137
end

spatial_features.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
2121
s.add_runtime_dependency "delayed_job_active_record", '~> 4.1'
2222
s.add_runtime_dependency "rgeo-shapefile", '~> 3.1'
2323
s.add_runtime_dependency "rgeo-geojson", '~> 2.1.1'
24-
s.add_runtime_dependency "rubyzip", '2.4.1' # FIXME: v3 doesn't support the non-block form of Zip::File.open, which is used in Unzip.entries
24+
s.add_runtime_dependency "rubyzip", "~> 3.0"
2525
s.add_runtime_dependency "nokogiri"
2626

2727
s.add_development_dependency "rails", '>= 7', '< 8'

0 commit comments

Comments
 (0)