fix: treat TorBox cached/completed status as downloaded
All checks were successful
CI/CD / Build & Push Docker Image (push) Successful in 1m11s

For instant/cached TorBox downloads, the API returns DownloadFinished=false
(no download happened - content was already cached) with DownloadState="cached"
or "completed". These should be treated as "downloaded" since content is
immediately available.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-31 11:27:05 -08:00
committed by John Ogle
parent b306248db6
commit 38d59cb01d

View File

@@ -171,10 +171,12 @@ func (tb *Torbox) SubmitMagnet(torrent *types.Torrent) (*types.Torrent, error) {
} }
func (tb *Torbox) getTorboxStatus(status string, finished bool) string { func (tb *Torbox) getTorboxStatus(status string, finished bool) string {
if finished { // For cached/completed torrents, content is immediately available even if
// DownloadFinished=false (no download actually happened - it was already cached)
if finished || status == "cached" || status == "completed" {
return "downloaded" return "downloaded"
} }
downloading := []string{"completed", "cached", "paused", "downloading", "uploading", downloading := []string{"paused", "downloading", "uploading",
"checkingResumeData", "metaDL", "pausedUP", "queuedUP", "checkingUP", "checkingResumeData", "metaDL", "pausedUP", "queuedUP", "checkingUP",
"forcedUP", "allocating", "downloading", "metaDL", "pausedDL", "forcedUP", "allocating", "downloading", "metaDL", "pausedDL",
"queuedDL", "checkingDL", "forcedDL", "checkingResumeData", "moving"} "queuedDL", "checkingDL", "forcedDL", "checkingResumeData", "moving"}