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
  •  | 
  •  

문제

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

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top