Skip to content

Commit

Permalink
Possible fix for #3150 (Invalid cross-device link) without coping met…
Browse files Browse the repository at this point in the history
…adata
  • Loading branch information
OzzieIsaacs committed Sep 14, 2024
1 parent 88cb58c commit 1d9471b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cps/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,12 @@ def move_files_on_change(calibre_path, new_author_dir, new_titledir, localbook,
if original_filepath:
if not os.path.isdir(new_path):
os.makedirs(new_path)
shutil.move(original_filepath, os.path.join(new_path, db_filename))
try:
shutil.move(original_filepath, os.path.join(new_path, db_filename))
except OSError:
log.error("Rename title from {} to {} failed with error, trying to "
"move without metadata".format(path, new_path))
shutil.move(original_filepath, os.path.join(new_path, db_filename), copy_function=shutil.copy)
log.debug("Moving title: %s to %s", original_filepath, new_path)
else:
# Check new path is not valid path
Expand Down

0 comments on commit 1d9471b

Please sign in to comment.