![](/img/trans.png)
[英]rubyzip error when generating zips of images on the fly : End-of-central-directory signature not found
[英]How can I avoid "Zip end of central directory signature not found (Zip::Error)" with rubyzip?
我正在使用 rubyzip 閱讀很多 zip 文件。
但是,此錯誤消息始終僅顯示在特定文件中,即使它是 zip 文件。
/app/vendor/bundle/ruby/2.3.0/gems/rubyzip-1.2.1/lib/zip/central_directory.rb:143:in `get_e_o_c_d': Zip 未找到中央目錄簽名的結尾(Zip::Error)
我猜這個錯誤發生在 rubyzip 中。
我該如何管理這個錯誤?
這是我的代碼。
url = 'http://example.zip'
zipfilename = open(url)
Zip::File.open(zipfilename, :allow_redirections => :all) do |zip_file|
entry = zip_file.glob("*ixbrl.htm").first
stream = entry.get_input_stream.read
puts stream
end
謝謝!
我遇到了同樣的錯誤。 也只能在 Heroku 上重現。 在我添加了一個解壓縮的 buildpack(第二個,在 Ruby 之后)后,這個錯誤得到了修復。
如果您使用的是 docs xlsx 文件,請嘗試檢查工作表鏈接的訪問權限是否是公開的。
就我而言,文件也已損壞。 上面有 Matheus Porto 的表演!
*Zip end of central directory signature not found (Zip::Error)*
./features/Classes/CSVmanubula.rb:268:in `new'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.