Merge pull request #284 from guahki/patch-1

Fix issues with deleting files with DELETE_FILE_ON_TRASHCAN
pull/286/head
Alex 2023-06-23 08:24:52 +03:00 committed by GitHub
commit f4a7b7a5ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -300,7 +300,10 @@ class DownloadQueue:
continue
if self.config.DELETE_FILE_ON_TRASHCAN:
dl = self.done.get(id)
try:
os.remove(os.path.join(dl.download_dir, dl.info.filename))
except Exception as e:
log.warn(f'deleting file for download {id} failed with error message {e}')
self.done.delete(id)
await self.notifier.cleared(id)
return {'status': 'ok'}