From fce128a10e6efd2e14b94cdbc9d3b5a93902e65a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 3 Feb 2022 20:05:43 +0530 Subject: [PATCH] Edit book: Fix pasting files from another editor instance failing if a file with the same name already exists. Fixes #1959782 [Problems with drag and drop or adding files in the editor](https://bugs.launchpad.net/calibre/+bug/1959782) --- src/calibre/gui2/tweak_book/boss.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/gui2/tweak_book/boss.py b/src/calibre/gui2/tweak_book/boss.py index a2ae96ae27..ba8aeecdcf 100644 --- a/src/calibre/gui2/tweak_book/boss.py +++ b/src/calibre/gui2/tweak_book/boss.py @@ -1549,7 +1549,7 @@ class Boss(QObject): container = current_container() for name, (path, mt) in iteritems(name_map): with lopen(path, 'rb') as f: - container.add_file(name, f.read(), media_type=mt) + container.add_file(name, f.read(), media_type=mt, modify_name_if_needed=True) self.apply_container_update_to_gui() def export_file(self, name, path):