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:
@@ -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
|
||||
|
Reference in New Issue
Block a user