From 1e16f53631847b352509092156dadc2800171c8e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 29 May 2023 19:36:51 +0530 Subject: [PATCH] CHM Input: Fix a regression in the previous release that broke conversion of CHM files. Fixes #2021413 [chm->pdf conversion german umlauts TOC problem](https://bugs.launchpad.net/calibre/+bug/2021413) --- src/calibre/ebooks/conversion/plugins/chm_input.py | 1 + src/calibre/ebooks/conversion/plugins/html_input.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/conversion/plugins/chm_input.py b/src/calibre/ebooks/conversion/plugins/chm_input.py index 8a7d8da83c..fbdfb48a52 100644 --- a/src/calibre/ebooks/conversion/plugins/chm_input.py +++ b/src/calibre/ebooks/conversion/plugins/chm_input.py @@ -103,6 +103,7 @@ class CHMInput(InputFormatPlugin): from calibre.customize.builtins import HTMLInput opts.breadth_first = True htmlinput = HTMLInput(None) + htmlinput.set_root_dir_of_input(basedir) oeb = htmlinput.create_oebbook(htmlpath, basedir, opts, log, mi) return oeb diff --git a/src/calibre/ebooks/conversion/plugins/html_input.py b/src/calibre/ebooks/conversion/plugins/html_input.py index 9119698b61..b86348ce4e 100644 --- a/src/calibre/ebooks/conversion/plugins/html_input.py +++ b/src/calibre/ebooks/conversion/plugins/html_input.py @@ -76,6 +76,9 @@ class HTMLInput(InputFormatPlugin): } + def set_root_dir_of_input(self, basedir): + self.root_dir_of_input = os.path.normcase(get_long_path_name(os.path.abspath(basedir)) + os.sep) + def convert(self, stream, opts, file_ext, log, accelerators): self._is_case_sensitive = None @@ -86,7 +89,7 @@ class HTMLInput(InputFormatPlugin): if hasattr(stream, 'name'): basedir = os.path.dirname(stream.name) fname = os.path.basename(stream.name) - self.root_dir_of_input = os.path.normcase(get_long_path_name(os.path.abspath(basedir)) + os.sep) + self.set_root_dir_of_input(basedir) if file_ext != 'opf': if opts.dont_package: