mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
ODT Input: Handle malformed ODT files with no mimetype declaration
This commit is contained in:
parent
66263fdef1
commit
874367cef0
@ -607,7 +607,10 @@ def load(odffile):
|
||||
Returns a reference to the structure
|
||||
"""
|
||||
z = zipfile.ZipFile(odffile)
|
||||
mimetype = z.read('mimetype')
|
||||
try:
|
||||
mimetype = z.read('mimetype')
|
||||
except KeyError: # Added by Kovid to handle malformed odt files
|
||||
mimetype = 'application/vnd.oasis.opendocument.text'
|
||||
doc = OpenDocument(mimetype, add_generator=False)
|
||||
|
||||
# Look in the manifest file to see if which of the four files there are
|
||||
|
Loading…
x
Reference in New Issue
Block a user