mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Zip file reading: Be more tolerant when a zip file has a damaged directory
This commit is contained in:
parent
7fde6cbead
commit
ee246b73ec
@ -982,9 +982,12 @@ class ZipFile:
|
|||||||
zef_file.read(fheader[_FH_EXTRA_FIELD_LENGTH])
|
zef_file.read(fheader[_FH_EXTRA_FIELD_LENGTH])
|
||||||
|
|
||||||
if fname != zinfo.orig_filename:
|
if fname != zinfo.orig_filename:
|
||||||
raise BadZipfile, \
|
print ('WARNING: Header (%r) and directory (%r) filenames do not'
|
||||||
'File name in directory "%s" and header "%s" differ.' % (
|
' match inside ZipFile')%(fname, zinfo.orig_filename)
|
||||||
zinfo.orig_filename, fname)
|
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
|
# check for encrypted flag & handle password
|
||||||
is_encrypted = zinfo.flag_bits & 0x1
|
is_encrypted = zinfo.flag_bits & 0x1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user