Skip to content

fix(alldebrid): don't treat a ready magnet with no files yet as downloaded - #406

Open
NoxzRCW wants to merge 1 commit into
sirrobot01:betafrom
NoxzRCW:fix/122-alldebrid-ready-with-no-files
Open

NoxzRCW wants to merge 1 commit into
sirrobot01:betafrom
NoxzRCW:fix/122-alldebrid-ready-with-no-files

Conversation

@NoxzRCW

@NoxzRCW NoxzRCW commented Sep 2, 2026

Copy link
Copy Markdown

📌 Description


Target Branch Check (IMPORTANT)

  • I confirm this PR is targeting the correct branch

Expected target:

  • beta (for features)

Changes Made

  • Extracted the progress/files handling from GetTorrent and updateTorrent into a shared applyMagnetFiles helper
  • When status is "downloaded" but the flattened files list is empty and the reported size is greater than zero, keep the torrent as downloading instead of downloaded
  • Added tests covering both the empty files case and the normal case where files are present

Testing

  • Tested locally

Steps:

  1. Wrote a fake /magnet/status server returning statusCode 4 with an empty files array and a nonzero size, confirmed GetTorrent and UpdateTorrent both report the torrent as still downloading with this patch, and confirmed they reported it downloaded before the patch, which reproduces Radarr not processing Decypharr symlinks #113/Decypharr symlink issue on qbit mount #122
  2. Ran the same test with files populated to make sure a genuinely finished torrent is not affected, still reported downloaded with progress at 100
  3. Ran the full test suite (go test ./...) plus go vet and gofmt, all clean

Risks / Notes

  • Only touches AllDebrid's GetTorrent/updateTorrent, other providers aren't affected
  • A torrent that genuinely has zero size and zero files still gets treated as downloaded like before, this only changes behavior when the reported size is greater than zero

Screenshots (if applicable)

N/A


Checklist

  • Code builds successfully
  • No console/log errors
  • Reviewed my own code
  • Target branch is correct

…oaded

AllDebrid can send statusCode 4 (ready) in a magnet/status response before
the files array in that same response is actually filled in. GetTorrent and
updateTorrent were trusting that status right away, so decypharr marked the
torrent downloaded and moved straight into creating symlinks for zero files.
That matches what people keep reporting in sirrobot01#113 and sirrobot01#122: the download
finishes fine on AllDebrid's side, but the folder decypharr creates for it
ends up empty and the arr never sees anything to import.

Both functions now fall back to downloading when the files list comes back
empty while the reported size is greater than zero, so the next status poll
picks up the real file list instead of decypharr giving up on it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant