From 5bb235772dd57e3dd41b3e319cdc99c90411040e Mon Sep 17 00:00:00 2001 From: gryf Date: Sun, 12 Apr 2020 13:44:38 +0200 Subject: [PATCH] Fix issue with crash on LibreOffice format. During tests, there was issue regarding ODF2XHTML.xhtml() method, which assumes, that all lines are stored as strings. Although, in case of single items, like footnotes, there is a chance, that numbers are stored as ints. In this patch we assure, that all lines has to be strings. This bug also affects current version of Calibre (as of cf5baaf449 commit). --- ebook_converter/ebooks/odt/input.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ebook_converter/ebooks/odt/input.py b/ebook_converter/ebooks/odt/input.py index 23a8a69..7a7bf90 100644 --- a/ebook_converter/ebooks/odt/input.py +++ b/ebook_converter/ebooks/odt/input.py @@ -280,7 +280,11 @@ class Extract(ODF2XHTML): if not mi.authors: mi.authors = [_('Unknown')] self.filter_load(stream, mi, log) - html = self.xhtml() + + # NOTE(gryf): Here is a workaround for ODF2XHTML.xhtml() method, + # which expects, that all lines are strings. + html = ''.join([str(l) for l in self.lines]) + # A blanket img specification like this causes problems # with EPUB output as the containing element often has # an absolute height and width set that is larger than