reintroduce correct failure handling

This commit is contained in:
Sebastian Spaeth 2023-01-12 14:53:32 +01:00
parent 3914546c92
commit 7b6ecf25ac

View File

@ -59,10 +59,10 @@ class File:
if self.fullpath is None: if self.fullpath is None:
logging.info(f"No known path for file id '{self.media_id}', cannot delete file.") logging.info(f"No known path for file id '{self.media_id}', cannot delete file.")
res = False res = False
if not self.fullpath.is_dir(): elif not self.fullpath.is_dir():
logging.debug(f"Path for file id '{self.media_id}' is not a directory or does not exist, not deleting.") logging.debug(f"Path for file id '{self.media_id}' is not a directory or does not exist, not deleting.")
res = False res = False
else:
for file in self.fullpath.glob('*'): for file in self.fullpath.glob('*'):
# note: this does not handle directories in fullpath # note: this does not handle directories in fullpath
file.unlink() file.unlink()