mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-10 20:10:00 +00:00
Possible fix for #3150 (Invalid cross-device link) without coping metadata
This commit is contained in:
parent
88cb58c285
commit
1d9471b252
@ -535,7 +535,12 @@ def move_files_on_change(calibre_path, new_author_dir, new_titledir, localbook,
|
|||||||
if original_filepath:
|
if original_filepath:
|
||||||
if not os.path.isdir(new_path):
|
if not os.path.isdir(new_path):
|
||||||
os.makedirs(new_path)
|
os.makedirs(new_path)
|
||||||
|
try:
|
||||||
shutil.move(original_filepath, os.path.join(new_path, db_filename))
|
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)
|
log.debug("Moving title: %s to %s", original_filepath, new_path)
|
||||||
else:
|
else:
|
||||||
# Check new path is not valid path
|
# Check new path is not valid path
|
||||||
|
Loading…
Reference in New Issue
Block a user