From 2de6aafdfbe747ddc9ded2c4b376c0b9dd4c1eba Mon Sep 17 00:00:00 2001 From: shirshasa Date: Mon, 13 Sep 2021 20:17:02 +0300 Subject: [PATCH] epub converter: fix finding full path in internal links processing --- src/epub_converter.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/epub_converter.py b/src/epub_converter.py index c50dc40..056deb1 100644 --- a/src/epub_converter.py +++ b/src/epub_converter.py @@ -304,9 +304,11 @@ class EpubConverter: soup = self.href2soup_html[toc_href] for internal_link_tag in soup.find_all('a', {'href': internal_link_reg2}): a_tag_href, a_tag_id = internal_link_tag.attrs['href'].split('#') - a_tag_href = a_tag_href or toc_href # find full path - a_tag_href_matched_to_toc = self.match_href_to_path_from_toc(toc_href, a_tag_href, internal_link_tag) + if a_tag_href: + a_tag_href_matched_to_toc = self.match_href_to_path_from_toc(toc_href, a_tag_href, internal_link_tag) + else: + a_tag_href_matched_to_toc = os.path.normpath(toc_href).replace('\\', '/') if not a_tag_href_matched_to_toc: continue new_id = self._create_unique_id(a_tag_href_matched_to_toc, a_tag_id)