mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-22 18:43:20 +02:00
Fix #402
This commit is contained in:
parent
4e856a3481
commit
42a90b9515
1 changed files with 5 additions and 6 deletions
|
|
@ -24,17 +24,14 @@
|
|||
>>> lrf.category = "History"
|
||||
"""
|
||||
|
||||
import struct, zlib, sys, re
|
||||
import struct, zlib, sys
|
||||
from shutil import copyfileobj
|
||||
from cStringIO import StringIO
|
||||
import xml.dom.minidom as dom
|
||||
from functools import wraps
|
||||
from xml.parsers.expat import ParserCreate
|
||||
|
||||
from libprs500.devices.prs500.prstypes import field
|
||||
from libprs500.ebooks.metadata import MetaInformation
|
||||
from libprs500.ebooks.BeautifulSoup import BeautifulStoneSoup
|
||||
|
||||
|
||||
BYTE = "<B" #: Unsigned char little endian encoded in 1 byte
|
||||
WORD = "<H" #: Unsigned short little endian encoded in 2 bytes
|
||||
|
|
@ -366,8 +363,10 @@ def fget(self):
|
|||
if len(src) != self.uncompressed_info_size:
|
||||
raise LRFException("Decompression of document meta info\
|
||||
yielded unexpected results")
|
||||
src = src.replace('\x00', '').strip()
|
||||
return dom.parseString(src)
|
||||
try:
|
||||
return dom.parseString(src)
|
||||
except:
|
||||
return dom.parseString(src.replace('\x00', '').strip())
|
||||
except zlib.error:
|
||||
raise LRFException("Unable to decompress document meta information")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue