mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-20 18:56:07 +01:00
Fix #1326: Warn instead of fail on MS-DES block-size error.
This commit is contained in:
commit
86d30f2732
1 changed files with 9 additions and 2 deletions
|
|
@ -367,8 +367,10 @@ def __eq__(self, other):
|
||||||
return self.internal == other
|
return self.internal == other
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "ManifestItem(internal=%s, path=%s)" \
|
return "ManifestItem(internal=%r, path=%r, mime_type=%r, " \
|
||||||
% (repr(self.internal), repr(self.path))
|
"offset=%d, root=%r, state=%r)" \
|
||||||
|
% (self.internal, self.path, self.mime_type, self.offset,
|
||||||
|
self.root, self.state)
|
||||||
|
|
||||||
def preserve(function):
|
def preserve(function):
|
||||||
def wrapper(self, *args, **kwargs):
|
def wrapper(self, *args, **kwargs):
|
||||||
|
|
@ -731,6 +733,11 @@ def _get_section(self, section):
|
||||||
return content
|
return content
|
||||||
|
|
||||||
def _decrypt(self, content):
|
def _decrypt(self, content):
|
||||||
|
length = len(content)
|
||||||
|
extra = length & 0x7
|
||||||
|
if extra > 0:
|
||||||
|
self._warn("content length not a multiple of block size")
|
||||||
|
content += "\0" * (8 - extra)
|
||||||
msdes.deskey(self.bookkey, msdes.DE1)
|
msdes.deskey(self.bookkey, msdes.DE1)
|
||||||
return msdes.des(content)
|
return msdes.des(content)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue