Skip to content

Commit

Permalink
Merge pull request #6380 from drew2a/fix/6299
Browse files Browse the repository at this point in the history
Fix #6299
  • Loading branch information
drew2a authored Sep 28, 2021
2 parents 8c51ae6 + 0ab90a0 commit b0f7fd7
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
from pathlib import Path

from ipv8.taskmanager import TaskManager

from tribler_common.simpledefs import NTFY

from tribler_core.modules.libtorrent.download_manager import DownloadManager
from tribler_core.modules.libtorrent.torrentdef import TorrentDef
from tribler_core.notifier import Notifier
Expand Down Expand Up @@ -35,8 +33,12 @@ def cleanup_torrent_file(self, root, name):
if not fullpath.exists():
self._logger.warning("File with path %s does not exist (anymore)", root / name)
return
path = Path(str(fullpath) + ".corrupt")
try:
fullpath.rename(path)
except PermissionError as e:
self._logger.warning(f'Cant rename the file to {path}. Exception: {e}')

fullpath.rename(Path(str(fullpath)+".corrupt"))
self._logger.warning("Watch folder - corrupt torrent file %s", name)
self.notifier.notify(NTFY.WATCH_FOLDER_CORRUPT_FILE, name)

Expand Down

0 comments on commit b0f7fd7

Please sign in to comment.