2

I am using archive-zip gem for unzipping zip files inside ruby code to be used in a scheduler task. Some times it is working fine but few times i am getting "undefined method `new' for nil:NilClass" error while unzipping in Archive:zip line.

The code snippet is

require 'archive/zip'

Dir.foreach("#{Rails.public_path}/#{zip_folder}/") do |item|

Archive::Zip.extract("#{Rails.public_path}/#{zip_folder}/"+ item, "#{Rails.public_path}/#{zip_folder}/inspected/", :password => 'password')

end

Please help me.

Thanks in advance.

1 Answers1

0

The issue was the zip file using another Java library for zipping which was not compatible with Ruby Unzip library. So created another API to unzip using the same Java library.