Search code examples
rubyrubyziproo

Rubyzip error causing havoc in my logs


Essentially my log files look something like this right now:

Invalid date/time in zip entry
Invalid date/time in zip entry
Invalid date/time in zip entry
Invalid date/time in zip entry
Invalid date/time in zip entry
Invalid date/time in zip entry
...

Now under some investigation, I've found that this is due to Rubyzip and also due to when I seem to open a file in the following way...

require 'roo'

#Define files to read with location specify

today_file=(File.dirname(__FILE__) + '/output/today-report.xlsx')

yesterday_file=(File.dirname(__FILE__) + '/output/yesterday-report.xlsx')

lm_file=(File.dirname(__FILE__) + '/output/lm-report.xlsx')

#Define initial variables
txls = Roo::Excelx.new(today_file)
yxls = Roo::Excelx.new(yesterday_file)
lmxls = Roo::Excelx.new(lm_file)

Essentially this code is using a Ruby library called 'Roo' to open up some spreadsheets. All the code does is specify the current folder/specific file and then open using Roo.

I've rewritten these lines a few different ways to try and stop Rubyzip being as irritating but to no avail. Does anybody have any clue as to what is wrong here?

Thanks.


Solution

  • Even better answer... add this to your ruby job

    Zip.warn_invalid_date = false