rubyzip error when generating zips of images on the fly : End-of-central-directory signature not found

StackOverflow https://stackoverflow.com/questions/5407168

  •  29-10-2019
  •  | 
  •  

Question

I'm generating a zip file from a collection of images which is then sent to the user.

I'm using code which is almost exactly the same as the example given on this page;

http://info.michael-simons.eu/2008/01/21/using-rubyzip-to-create-zip-files-on-the-fly/

It works absolutely fine on my local development box, but when I run it on my staging server, I get a zero length zipfile which has the following error when I try to open it.

'End-of-central-directory signature not found'

Obviously it's hard to troubleshoot where I'm going wrong when it works fine on my development machine!

Cheers, Graeme

Was it helpful?

Solution

Got it!

It's because Rails 3 defaults to using x_sendfile, which the server isn't setup for.

Nothing to do with zips at all in the end, it's simply file sending. This post explains everything;

Rails sends 0 byte files using send_file

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top