From 34ce1bac5688c5b82331cf6b953e4773b0037374 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sun, 18 Aug 2019 22:39:02 -0700 Subject: [PATCH] Don't add unchanged paths to the rename_map. --- epubfile.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/epubfile.py b/epubfile.py index 4c067da..41370a7 100644 --- a/epubfile.py +++ b/epubfile.py @@ -877,8 +877,9 @@ class Epub: os.makedirs(directory.absolute_path, exist_ok=True) new_filepath = directory.with_child(old_filepath.basename) - rename_map[old_filepath] = new_filepath - os.rename(old_filepath.absolute_path, new_filepath.absolute_path) + if new_filepath != old_filepath: + rename_map[old_filepath] = new_filepath + os.rename(old_filepath.absolute_path, new_filepath.absolute_path) manifest_item['href'] = new_filepath.relative_to(self.opf_filepath.parent, simple=True) self.fix_interlinking_opf(rename_map)