开发者

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

开发者 https://www.devze.com 2023-02-19 10:03 出处:网络
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;

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

0

精彩评论

暂无评论...
验证码 换一张
取 消