From 07a77403a8e51c8aa830c1c44d8135f1281db496 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 12 Sep 2023 22:21:33 +0530 Subject: [PATCH] Fix retiring a note with a resource throwing an error if a version of the note with the same resource is already retired --- src/calibre/db/notes/connect.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/db/notes/connect.py b/src/calibre/db/notes/connect.py index 83e06dbbea..c6ff696523 100644 --- a/src/calibre/db/notes/connect.py +++ b/src/calibre/db/notes/connect.py @@ -172,7 +172,8 @@ class Notes: rpath = make_long_path_useable(self.path_for_resource(rhash)) if os.path.exists(rpath): rdest = os.path.join(destdir, 'res-'+rname) - copyfile_using_links(rpath, make_long_path_useable(rdest), dest_is_dir=False) + with suppress(shutil.SameFileError): + copyfile_using_links(rpath, make_long_path_useable(rdest), dest_is_dir=False) self.trim_retired_dir() def unretire(self, conn, field_name, item_id, item_value) -> int: