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. # Compress this archive and return the resulting zip file as a String.
# #
def pack def pack
ret = '' ret = ''.unpack("C*").pack("C*")
# save the offests # save the offests
offsets = [] offsets = []

View File

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