debug: add logging and case-insensitive check for TorBox status
All checks were successful
CI/CD / Build & Push Docker Image (push) Successful in 1m15s

Added debug logging to see actual DownloadState values from TorBox API.
Also made status comparison case-insensitive.

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

View File

@@ -171,9 +171,17 @@ 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 {
// Log raw values for debugging
tb.logger.Debug().
Str("download_state", status).
Bool("download_finished", finished).
Msg("getTorboxStatus called")
// For cached/completed torrents, content is immediately available even if // For cached/completed torrents, content is immediately available even if
// DownloadFinished=false (no download actually happened - it was already cached) // DownloadFinished=false (no download actually happened - it was already cached)
if finished || status == "cached" || status == "completed" { // Use case-insensitive comparison for safety
statusLower := strings.ToLower(status)
if finished || statusLower == "cached" || statusLower == "completed" {
return "downloaded" return "downloaded"
} }
downloading := []string{"paused", "downloading", "uploading", downloading := []string{"paused", "downloading", "uploading",