1
0
mirror of https://github.com/janeczku/calibre-web synced 2025-10-13 14:47:40 +00:00

Fix deletion of books with multiple custom column links

Fix delete of author-folder in case last book of author was deleted (#1269)
This commit is contained in:
Ozzieisaacs
2020-04-26 20:44:37 +02:00
parent d9dde36c74
commit bc89b0658a
2 changed files with 53 additions and 38 deletions

View File

@@ -283,6 +283,9 @@ def delete_book_file(book, calibrepath, book_format=None):
log.error("Deleting book %s failed, path has subfolders: %s", book.id, book.path)
return False
shutil.rmtree(path, ignore_errors=True)
authorpath = os.path.join(calibrepath, os.path.split(book.path)[0])
if not os.listdir(authorpath):
shutil.rmtree(authorpath, ignore_errors=True)
return True
else:
log.error("Deleting book %s failed, book path not valid: %s", book.id, book.path)