From b7fa9b124e33a261358ec90eed0b66769f17fcba Mon Sep 17 00:00:00 2001 From: Sergey Konotopov Date: Sat, 7 Mar 2015 12:50:13 +0300 Subject: [PATCH] Fixing Zip#read_local_entry error on JRuby --- .gitignore | 2 ++ lib/zip/entry.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 130272fb..f870b5cb 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ Gemfile.lock +samples/*.zip.* coverage pkg/ +.ruby-gemset +.ruby-version diff --git a/lib/zip/entry.rb b/lib/zip/entry.rb index 05ca23b4..c1563565 100755 --- a/lib/zip/entry.rb +++ b/lib/zip/entry.rb @@ -221,7 +221,7 @@ def unpack_local_entry(buf) def read_local_entry(io) #:nodoc:all @local_header_offset = io.tell - static_sized_fields_buf = io.read(::Zip::LOCAL_ENTRY_STATIC_HEADER_LENGTH) + static_sized_fields_buf = io.read(::Zip::LOCAL_ENTRY_STATIC_HEADER_LENGTH) || '' unless static_sized_fields_buf.bytesize == ::Zip::LOCAL_ENTRY_STATIC_HEADER_LENGTH raise Error, "Premature end of file. Not enough data for zip entry local header"