Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
- Add changelog link to gemspec [605](https://github.com/roo-rb/roo/pull/605)
- Upgraded rack via usage of rackup
- Resolve deprecation warnings about uri DEFAULT_PARSER
- Add support for rubyzip 3.x [629](https://github.com/roo-rb/roo/pull/629)

### Removed
- Support for ruby 2.7, 3.0
- Support for rubyzip < 3.x

## [2.10.1] 2024-01-17

Expand Down
12 changes: 6 additions & 6 deletions lib/roo/excelx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def extract_worksheet_ids(entries, path)
wb = entries.find { |e| e.name[/workbook.xml$/] }
fail ArgumentError 'missing required workbook file' if wb.nil?

wb.extract(path)
wb.extract(File.basename(path), destination_directory: File.dirname(path))
workbook_doc = Roo::Utils.load_xml(path).remove_namespaces!
workbook_doc.xpath('//sheet').map { |s| s['id'] }
end
Expand All @@ -357,7 +357,7 @@ def extract_worksheet_rels(entries, path)
wb_rels = entries.find { |e| e.name[/workbook.xml.rels$/] }
fail ArgumentError 'missing required workbook file' if wb_rels.nil?

wb_rels.extract(path)
wb_rels.extract(File.basename(path), destination_directory: File.dirname(path))
rels_doc = Roo::Utils.load_xml(path).remove_namespaces!

relationships = rels_doc.xpath('//Relationship').select do |relationship|
Expand All @@ -378,7 +378,7 @@ def extract_sheets_in_order(entries, sheet_ids, sheets, tmpdir)
path = "#{tmpdir}/roo_sheet#{i + 1}"
sheet_files << path
@sheet_files << path
entry.extract(path)
entry.extract(File.basename(path), destination_directory: File.dirname(path))
end
end

Expand All @@ -387,7 +387,7 @@ def extract_images(entries, tmpdir)
img_entries.each do |entry|
path = "#{@tmpdir}/roo#{entry.name.gsub(/xl\/|\//, "_")}"
image_files << path
entry.extract(path)
entry.extract(File.basename(path), destination_directory: File.dirname(path))
end
end

Expand All @@ -402,7 +402,7 @@ def process_zipfile(zipfilename_or_stream)
zip_file.read_from_stream zipfilename_or_stream
end

process_zipfile_entries zip_file.to_a.sort_by(&:name)
process_zipfile_entries zip_file.entries.sort_by(&:name)
end

def process_zipfile_entries(entries)
Expand Down Expand Up @@ -462,7 +462,7 @@ def process_zipfile_entries(entries)
image_rels[nr - 1] = "#{@tmpdir}/roo_image_rels#{nr}"
end

entry.extract(path) if path
entry.extract(File.basename(path), destination_directory: File.dirname(path)) if path
end
end

Expand Down
4 changes: 2 additions & 2 deletions lib/roo/open_office.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def open_oo_file(options)
fail ArgumentError, ERROR_MISSING_CONTENT_XML unless content_entry

roo_content_xml_path = ::File.join(@tmpdir, 'roo_content.xml')
content_entry.extract(roo_content_xml_path)
content_entry.extract('roo_content.xml', destination_directory: @tmpdir)
decrypt_if_necessary(zip_file, content_entry, roo_content_xml_path, options)
end
end
Expand Down Expand Up @@ -234,7 +234,7 @@ def decrypt_if_necessary(

if (manifest_entry = zip_file.glob('META-INF/manifest.xml').first)
roo_manifest_xml_path = File.join(@tmpdir, 'roo_manifest.xml')
manifest_entry.extract(roo_manifest_xml_path)
manifest_entry.extract('roo_manifest.xml', destination_directory: @tmpdir)
manifest = ::Roo::Utils.load_xml(roo_manifest_xml_path)

# XPath search for manifest:encryption-data only for the content.xml
Expand Down
2 changes: 1 addition & 1 deletion roo.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
end

spec.add_dependency 'nokogiri', '~> 1'
spec.add_dependency 'rubyzip', '>= 1.3.0', '< 3.0.0'
spec.add_dependency 'rubyzip', '>= 3.0.0', '< 4.0.0'

spec.add_development_dependency 'rake'
spec.add_development_dependency 'minitest', '~> 5.4', '>= 5.4.3'
Expand Down