mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-02-03 19:13:41 +01:00
Zip file reading: Be more tolerant when a zip file has a damaged directory
This commit is contained in:
parent
7fde6cbead
commit
ee246b73ec
1 changed files with 6 additions and 3 deletions
|
|
@ -982,9 +982,12 @@ def open(self, name, mode="r", pwd=None):
|
|||
zef_file.read(fheader[_FH_EXTRA_FIELD_LENGTH])
|
||||
|
||||
if fname != zinfo.orig_filename:
|
||||
raise BadZipfile, \
|
||||
'File name in directory "%s" and header "%s" differ.' % (
|
||||
zinfo.orig_filename, fname)
|
||||
print ('WARNING: Header (%r) and directory (%r) filenames do not'
|
||||
' match inside ZipFile')%(fname, zinfo.orig_filename)
|
||||
print 'Using directory filename %r'%zinfo.orig_filename
|
||||
#raise BadZipfile, \
|
||||
# 'File name in directory "%r" and header "%r" differ.' % (
|
||||
# zinfo.orig_filename, fname)
|
||||
|
||||
# check for encrypted flag & handle password
|
||||
is_encrypted = zinfo.flag_bits & 0x1
|
||||
|
|
|
|||
Loading…
Reference in a new issue