Skip to content

fix: qBittorrent uses the RMAB category's save path in Manual mode - #467

Merged
kikootwo merged 4 commits into
mainfrom
fix/326-qbittorrent-auto-tmm
Oct 27, 2026
Merged

kikootwo merged 4 commits into
mainfrom
fix/326-qbittorrent-auto-tmm

Conversation

@kikootwo

@kikootwo kikootwo commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

Closes #326

What changed

  • src/lib/integrations/qbittorrent.service.ts: both add paths (magnet link and .torrent file) now send autoTMM=true along with the readmeabook category, and still no savepath. The new placementFields() holds the rule and the reason.
  • When ensureCategory() fails (it now returns false instead of only logging), the category may be missing or have no save path. The add then sends autoTMM=false with savepath set to the resolved download folder (download_dir plus the client's customPath, with remote path mapping applied), so the files still land where RMAB imports from.
  • tests/helpers/fake-qbittorrent.ts: records the text fields of multipart adds (it already recorded form-encoded ones) and can make /torrents/categories fail. It never validated fields, so the extra one needed no change; the e2e fake (e2e/fake-arr/src/qbit.js) ignores unknown fields too.
  • Docs: documentation/phase3/download-clients.md (qBittorrent line under the resolved download path) and documentation/phase3/qbittorrent.md (Category Management line, Fixed Issues fix: Install all dependencies for build, then prune dev deps #20).

Why

RMAB creates the readmeabook category with the right save path and leaves savepath off each add so the category decides. But an add without autoTMM takes qBittorrent's default Torrent Management Mode, and in Manual mode the category's save path is ignored. Torrents then went to qBittorrent's global default folder and the import failed.

Leaving savepath off still matters: in Automatic mode qBittorrent keeps using its "incomplete downloads" folder for the category.

For the fallback: if the category could not be created or checked, Automatic mode would put the files in qBittorrent's default folder plus the category name, which is not RMAB's folder. An explicit save path in Manual mode is the only placement RMAB can be sure of there.

autoTMM on /torrents/add arrived in qBittorrent Web API 2.2.0, first released in qBittorrent 4.1.5. qBittorrent 4.1.0 to 4.1.4 ignore the field, so they behave as they do today.

Evidence

  • New tests/integrations/qbittorrent-auto-tmm.test.ts runs the real service against the fake qBittorrent over HTTP, for a magnet link and a .torrent file: the add carries category=readmeabook and autoTMM=true with no savepath; with /torrents/categories failing it carries autoTMM=false and savepath set to the download folder, and to the remote-mapped folder when path mapping is on.
  • tests/integrations/qbittorrent.service.test.ts: ensureCategory() resolves false when it fails; the add tests that stub it now stub success (true).
  • With main's qbittorrent.service.ts (8ee4a84) and this branch's tests: 7 failed, 84 passed, all on an assertion (the six add requests have no autoTMM or savepath; ensureCategory() resolves undefined). On this branch: 91/91 pass.

Checks

  • Unit tests for the changed code (vitest related on qbittorrent.service.ts, plus the new test file): PASS, 107 files, 1657/1657. vitest related on the fake helper: PASS, 5 files, 106/106
  • Type check and lint: PASS (tsc --noEmit clean; ESLint reports nothing new in the 4 touched code and test files compared with main)
  • No image build or E2E run: the change is in src/lib and tests only
  • After merging main (dad0daf): vitest related on the source changed on both sides: PASS, 129 files, 2680/2680; tsc --noEmit clean
  • Full unit suite: PR Tests (CI)

Risk and rollback

  • RMAB's torrents are now under Automatic Torrent Management in every setup, not only where qBittorrent's default mode was already Automatic. Two things follow for Manual-mode users, decided by qBittorrent's own settings:
    • If the category's save path changes later (a new download_dir, customPath or path mapping, which RMAB syncs on the next add), qBittorrent may move existing readmeabook torrents to the new path ("When Category Save Path changed"; qBittorrent's default switches them to Manual mode instead).
    • A post-import category (per-client setting, applied after a successful import) can make qBittorrent move the torrent's files to that category's path, or to qBittorrent's default folder plus the category name when that category has no path of its own ("When Torrent Category changed"; qBittorrent's default relocates). Across filesystems qBittorrent copies the files and then deletes the originals, while seeding. The import is already done by then, and the seeding cleanup deletes through qBittorrent (deleteDownload(id, true)), which knows the new location.
  • The fallback only runs when ensureCategory() fails. Before, those adds sent no save path and took qBittorrent's default; now they name RMAB's download folder in Manual mode. qBittorrent-compatible clients whose category calls fail now get an explicit savepath too.
  • qBittorrent 4.1.0 to 4.1.4: no change (the field is ignored).
  • Rollback: revert this PR. Torrents already added keep Automatic mode in qBittorrent until changed there; nothing in RMAB's database changes.

Release note

🤖 Generated with Claude Code

kikootwo and others added 4 commits October 27, 2026 02:18
…egory save path applies (#326)

Adds sent the readmeabook category without a savepath and without autoTMM, so
with qBittorrent's default Torrent Management Mode set to Manual the torrent
went to the global default folder and the import failed. Both add paths now
send autoTMM=true and still no savepath. When ensureCategory() fails, the
category's path is unknown, so the add sends autoTMM=false with the resolved
(remote-mapped) download folder as savepath.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kikootwo
kikootwo marked this pull request as ready for review October 27, 2026 06:51
@kikootwo
kikootwo merged commit 3589618 into main Oct 27, 2026
1 check passed
@kikootwo
kikootwo deleted the fix/326-qbittorrent-auto-tmm branch October 27, 2026 06:56
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.

Bug: qBittorrent downloads ignore category save path when default torrent management is Manual

1 participant