Message79155
If you have a .zip file with an incomplete "End of Central Directory"
record, _EndRecData() will throw a struct.error:
D:\c64workdir\Ultimate_Mag_Archive>e:ziptest.py "old -
Ultimate_Mag_Archive"
Handling A-z\0\64times01-double.zip
Traceback (most recent call last):
File "E:\wwwroot\c64db\tools\ziptest.py", line 48, in <module>
ok = handle_file(data, rel_filename)
File "E:\wwwroot\c64db\tools\ziptest.py", line 19, in handle_file
z = zipfile.ZipFile(cStringIO.StringIO(data), "r")
File "C:\Python26\lib\zipfile.py", line 698, in __init__
self._GetContents()
File "C:\Python26\lib\zipfile.py", line 718, in _GetContents
self._RealGetContents()
File "C:\Python26\lib\zipfile.py", line 728, in _RealGetContents
endrec = _EndRecData(fp)
File "C:\Python26\lib\zipfile.py", line 219, in _EndRecData
endrec = list(struct.unpack(structEndArchive, recData))
struct.error: unpack requires a string argument of length 22
The fix is to include a check to see if there is data enough for the
whole record before attempting to unpack. |
|
Date |
User |
Action |
Args |
2009-01-05 15:24:11 | ymgve | set | recipients:
+ ymgve |
2009-01-05 15:24:11 | ymgve | set | messageid: <1231169051.46.0.731825269948.issue4844@psf.upfronthosting.co.za> |
2009-01-05 15:24:10 | ymgve | link | issue4844 messages |
2009-01-05 15:24:09 | ymgve | create | |
|