Class: Zip::ZipCentralDirectory

Inherits:
Object
  • Object
show all
Defined in:
lib/swissmatch/zip.rb

Overview

Patching the rubyzip gem

Instance Method Summary collapse

Instance Method Details

#read_e_o_c_d(io) ⇒ Object

Patching the rubyzip gem



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/swissmatch/zip.rb', line 21

def read_e_o_c_d(io) #:nodoc:
  buf = get_e_o_c_d(io)
  @numberOfThisDisk                     = ZipEntry::read_zip_short(buf)
  @numberOfDiskWithStartOfCDir          = ZipEntry::read_zip_short(buf)
  @totalNumberOfEntriesInCDirOnThisDisk = ZipEntry::read_zip_short(buf)
  @size                                 = ZipEntry::read_zip_short(buf)
  @sizeInBytes                          = ZipEntry::read_zip_long(buf)
  @cdirOffset                           = ZipEntry::read_zip_long(buf)
  commentLength                         = ZipEntry::read_zip_short(buf)
  @comment                              = buf.read(commentLength)

  # ORIGINAL
  # raise ZipError, "Zip consistency problem while reading eocd structure" unless buf.size == 0

  # PATCH, doing it in a similar fashion as Archive::Zip in perl does
  raise ZipError, "Zip consistency problem while reading eocd structure" if @comment.bytesize != commentLength
  # /PATCH
end