diff --git a/src/calibre/ebooks/odt/input.py b/src/calibre/ebooks/odt/input.py index cda01cae60..b66f766e6d 100644 --- a/src/calibre/ebooks/odt/input.py +++ b/src/calibre/ebooks/odt/input.py @@ -26,7 +26,7 @@ class Extract(ODF2XHTML): if not os.path.exists('Pictures'): os.makedirs('Pictures') for name in zf.namelist(): - if name.startswith('Pictures'): + if name.startswith('Pictures') and name not in {'Pictures', 'Pictures/'}: data = zf.read(name) with open(name, 'wb') as f: f.write(data) diff --git a/src/odf/odfmanifest.py b/src/odf/odfmanifest.py index 07754fd2f3..a8f1655e88 100644 --- a/src/odf/odfmanifest.py +++ b/src/odf/odfmanifest.py @@ -1,17 +1,17 @@ #!/usr/bin/python # -*- coding: utf-8 -*- # Copyright (C) 2006-2007 Søren Roug, European Environment Agency -# +# # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. -# +# # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. -# +# # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA @@ -97,6 +97,7 @@ def manifestlist(manifestxml): inpsrc = InputSource() inpsrc.setByteStream(StringIO(manifestxml)) + parser.setFeature(handler.feature_external_ges, False) # Changed by Kovid to ignore external DTDs parser.parse(inpsrc) return odhandler.manifest diff --git a/src/odf/opendocument.py b/src/odf/opendocument.py index 0b59b271a4..8890c2a21d 100644 --- a/src/odf/opendocument.py +++ b/src/odf/opendocument.py @@ -598,6 +598,7 @@ def __loadxmlparts(z, manifest, doc, objectpath): inpsrc = InputSource() inpsrc.setByteStream(StringIO(xmlpart)) + parser.setFeature(handler.feature_external_ges, False) # Changed by Kovid to ignore external DTDs parser.parse(inpsrc) del doc._parsing except KeyError, v: pass