Make sure entries are 8-bit

unstable
HD Moore 2012-06-28 23:31:26 -05:00
parent e5dd6fc672
commit c45b1037f1
2 changed files with 5 additions and 7 deletions

View File

@ -65,7 +65,7 @@ class Archive
# Compress this archive and return the resulting zip file as a String.
#
def pack
ret = ''
ret = ''.unpack("C*").pack("C*")
# save the offests
offsets = []

View File

@ -14,8 +14,8 @@ class Entry
attr_reader :data
def initialize(fname, data, compmeth, timestamp=nil, attrs=nil, xtra=nil, comment=nil)
@name = fname
@data = data
@name = fname.unpack("C*").pack("C*")
@data = data.unpack("C*").pack("C*")
@xtra = xtra
@xtra ||= ''
@comment = comment
@ -37,7 +37,7 @@ class Entry
end
def data=(val)
@data = val
@data = val.unpack("C*").pack("C*")
compress
end
@ -84,11 +84,9 @@ class Entry
# Return the compressed data in a format suitable for adding to an Archive
#
def pack
ret = ''
# - lfh 1
lfh = LocalFileHdr.new(self)
ret << lfh.pack
ret = lfh.pack
# - data 1
if (@compdata)