diff --git a/src/calibre/utils/zipfile.py b/src/calibre/utils/zipfile.py index 56e96ee8eb..508d9fd319 100644 --- a/src/calibre/utils/zipfile.py +++ b/src/calibre/utils/zipfile.py @@ -222,7 +222,8 @@ def _EndRecData(fpin): endrec = list(struct.unpack(structEndArchive, recData)) comment = data[start+sizeEndCentDir:] # check that comment length is correct - if endrec[_ECD_COMMENT_SIZE] == len(comment): + # Kovid: Added == 0 check as some zip files apparently dont set this + if endrec[_ECD_COMMENT_SIZE] == 0 or endrec[_ECD_COMMENT_SIZE] == len(comment): # Append the archive comment and start offset endrec.append(comment) endrec.append(maxCommentStart + start)