From 2850a84bbc466e8d13af7e85dfd32c8c2ce4899b Mon Sep 17 00:00:00 2001 From: OzzieIsaacs Date: Wed, 10 Jan 2018 21:16:51 +0100 Subject: [PATCH] Fix for deleting books if book path contains no path (#432) --- cps/helper.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cps/helper.py b/cps/helper.py index 2863cc64..773dac35 100755 --- a/cps/helper.py +++ b/cps/helper.py @@ -307,9 +307,11 @@ def get_sorted_author(value): def delete_book(book, calibrepath): - path = os.path.join(calibrepath, book.path) # .replace('/',os.path.sep)).replace('\\',os.path.sep) - shutil.rmtree(path, ignore_errors=True) - + if "/" in book.path: + path = os.path.join(calibrepath, book.path) + shutil.rmtree(path, ignore_errors=True) + else: + logging.getLogger('cps.web').error("Deleting book " + str(book.id) + " failed, book path value: "+ book.path) # ToDo: Implement delete book on gdrive def delete_book_gdrive(book):