1
0
mirror of https://github.com/janeczku/calibre-web synced 2025-10-23 03:27:37 +00:00
Deleting of non exisiting folders gives no internal error anymore
re-inserting title sort function during upload earlier
This commit is contained in:
OzzieIsaacs
2018-07-14 23:03:54 +02:00
parent 8d406117ce
commit 694620790c
2 changed files with 11 additions and 7 deletions

View File

@@ -299,12 +299,16 @@ def delete_book_file(book, calibrepath):
# check that path is 2 elements deep, check that target path has no subfolders
if book.path.count('/') == 1:
path = os.path.join(calibrepath, book.path)
if len(next(os.walk(path))[1]):
web.app.logger.error(
"Deleting book " + str(book.id) + " failed, path has subfolders: " + book.path)
if os.path.isdir(path):
if len(next(os.walk(path))[1]):
web.app.logger.error(
"Deleting book " + str(book.id) + " failed, path has subfolders: " + book.path)
return False
shutil.rmtree(path, ignore_errors=True)
return True
else:
web.app.logger.error("Deleting book " + str(book.id) + " failed, book path not valid: " + book.path)
return False
shutil.rmtree(path, ignore_errors=True)
return True
else:
web.app.logger.error("Deleting book " + str(book.id) + " failed, book path value: "+ book.path)
return False