@@ -333,7 +333,7 @@ def extract_worksheet_ids(entries, path)
333
333
wb = entries . find { |e | e . name [ /workbook.xml$/ ] }
334
334
fail ArgumentError 'missing required workbook file' if wb . nil?
335
335
336
- wb . extract ( path )
336
+ wb . extract ( File . basename ( path ) , destination_directory : File . dirname ( path ) )
337
337
workbook_doc = Roo ::Utils . load_xml ( path ) . remove_namespaces!
338
338
workbook_doc . xpath ( '//sheet' ) . map { |s | s [ 'id' ] }
339
339
end
@@ -357,7 +357,7 @@ def extract_worksheet_rels(entries, path)
357
357
wb_rels = entries . find { |e | e . name [ /workbook.xml.rels$/ ] }
358
358
fail ArgumentError 'missing required workbook file' if wb_rels . nil?
359
359
360
- wb_rels . extract ( path )
360
+ wb_rels . extract ( File . basename ( path ) , destination_directory : File . dirname ( path ) )
361
361
rels_doc = Roo ::Utils . load_xml ( path ) . remove_namespaces!
362
362
363
363
relationships = rels_doc . xpath ( '//Relationship' ) . select do |relationship |
@@ -378,7 +378,7 @@ def extract_sheets_in_order(entries, sheet_ids, sheets, tmpdir)
378
378
path = "#{ tmpdir } /roo_sheet#{ i + 1 } "
379
379
sheet_files << path
380
380
@sheet_files << path
381
- entry . extract ( path )
381
+ entry . extract ( File . basename ( path ) , destination_directory : File . dirname ( path ) )
382
382
end
383
383
end
384
384
@@ -387,7 +387,7 @@ def extract_images(entries, tmpdir)
387
387
img_entries . each do |entry |
388
388
path = "#{ @tmpdir } /roo#{ entry . name . gsub ( /xl\/ |\/ / , "_" ) } "
389
389
image_files << path
390
- entry . extract ( path )
390
+ entry . extract ( File . basename ( path ) , destination_directory : File . dirname ( path ) )
391
391
end
392
392
end
393
393
@@ -402,7 +402,7 @@ def process_zipfile(zipfilename_or_stream)
402
402
zip_file . read_from_stream zipfilename_or_stream
403
403
end
404
404
405
- process_zipfile_entries zip_file . to_a . sort_by ( &:name )
405
+ process_zipfile_entries zip_file . entries . sort_by ( &:name )
406
406
end
407
407
408
408
def process_zipfile_entries ( entries )
@@ -462,7 +462,7 @@ def process_zipfile_entries(entries)
462
462
image_rels [ nr - 1 ] = "#{ @tmpdir } /roo_image_rels#{ nr } "
463
463
end
464
464
465
- entry . extract ( path ) if path
465
+ entry . extract ( File . basename ( path ) , destination_directory : File . dirname ( path ) ) if path
466
466
end
467
467
end
468
468
0 commit comments