Fix retiring a note with a resource throwing an error if a version of the note with the same resource is already retired

This commit is contained in:
Kovid Goyal 2023-09-12 22:21:33 +05:30
parent b9dcc6ee85
commit 07a77403a8
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -172,7 +172,8 @@ class Notes:
rpath = make_long_path_useable(self.path_for_resource(rhash)) rpath = make_long_path_useable(self.path_for_resource(rhash))
if os.path.exists(rpath): if os.path.exists(rpath):
rdest = os.path.join(destdir, 'res-'+rname) 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() self.trim_retired_dir()
def unretire(self, conn, field_name, item_id, item_value) -> int: def unretire(self, conn, field_name, item_id, item_value) -> int: