Skip to content

Commit

Permalink
Handle hashing multi-file torrents correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
kannibalox committed Mar 29, 2023
1 parent 93753ca commit 4f0c1b1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/ptpapi/scripts/ptp_reseed.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,11 @@ def load_torrent(
logger.debug("Starting hash check against %r", str(path))
pf = PieceFailer(data)
try:
data.hash_check(path, piece_callback=pf.check_piece)
data.add_fast_resume(path)
check_path = path
if data.is_multi_file:
check_path = Path(path, data["info"]["name"])
data.hash_check(check_path, piece_callback=pf.check_piece)
data.add_fast_resume(check_path)
except OSError as exc:
logger.error("Could not complete hash check: %s", exc)
return False
Expand Down

0 comments on commit 4f0c1b1

Please sign in to comment.