From b306248db673fdea9be96af3d38ddb652a924f72 Mon Sep 17 00:00:00 2001 From: susan Date: Sat, 31 Jan 2026 11:16:41 -0800 Subject: [PATCH] fix: directly set pausedUP state when debrid reports downloaded Previous fix relied on IsReady() calculation which might still fail due to edge cases with progress/AmountLeft values. This fix directly sets state to pausedUP when debridTorrent.Status == "downloaded" and TorrentPath is set, bypassing the IsReady() check entirely. Co-Authored-By: Claude Opus 4.5 --- pkg/wire/torrent.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/wire/torrent.go b/pkg/wire/torrent.go index cfd887b..0815acf 100644 --- a/pkg/wire/torrent.go +++ b/pkg/wire/torrent.go @@ -328,6 +328,17 @@ func (s *Store) updateTorrent(t *Torrent, debridTorrent *types.Torrent) *Torrent t = s.partialTorrentUpdate(t, debridTorrent) t.ContentPath = t.TorrentPath + // When debrid reports download complete and we have a path, mark as ready. + // This is a direct fix for TorBox where IsReady() might fail due to + // progress/AmountLeft calculation issues. + if debridTorrent.Status == "downloaded" && t.TorrentPath != "" { + t.State = "pausedUP" + t.Progress = 1.0 + t.AmountLeft = 0 + s.torrents.Update(t) + return t + } + if t.IsReady() { t.State = "pausedUP" s.torrents.Update(t)