From 671d5cec4be1f0f03384567e651d4246c7132b1c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 31 Aug 2024 15:38:08 +0530 Subject: [PATCH] Handle invalid xmnlns:= and xmlns= --- src/calibre/ebooks/oeb/reader.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/ebooks/oeb/reader.py b/src/calibre/ebooks/oeb/reader.py index 005d63159f..0fe46ca7e4 100644 --- a/src/calibre/ebooks/oeb/reader.py +++ b/src/calibre/ebooks/oeb/reader.py @@ -106,6 +106,8 @@ class OEBReader: elem.tag = OPF(barename(elem.tag)) nsmap.update(OPF2_NSMAP) attrib = dict(opf.attrib) + if xmlns := attrib.pop('xmlns:'): + attrib['xmlns'] = xmlns nroot = etree.Element(OPF('package'), nsmap={None: OPF2_NS}, attrib=attrib) metadata = etree.SubElement(nroot, OPF('metadata'), nsmap=nsmap)