The add-torrent handler compared the paused form value with prefs.StartPausedEnabled and sent no paused/stopped option when they matched. qBittorrent 5.x renamed that preference to add_stopped_enabled, so StartPausedEnabled reads false there. With "Start paused" off in qui and "Do not start the download automatically" on in qBittorrent, qui sent nothing and qBittorrent added the torrent stopped.
The handler now maps paused=true|false straight to paused and stopped, and no longer fetches app preferences for this. A request without paused still sends neither option, so the qBittorrent default applies. The stale comment about the comparison is removed.
No docs change: the dialog option already says what it does, and this makes it do that on qBittorrent 5.x.
Fixes #3117
Breaking change
No breaking change.
Behaviour change
With "Start paused" off, a torrent added from qui now starts even when qBittorrent's own add-stopped preference is on. Before, qBittorrent 5.x added it stopped.
How has this been tested?
New test TestAddTorrentHandler_PausedFormValueIsSentExplicitly covers paused=false, paused=true and no paused field, and checks that preferences are not fetched. Against the old handler the paused=false and paused=true rows fail.
Field test: I did not run it against a live qBittorrent 5.x instance. The handler test checks the options qui hands to the add call, which is the part this change touches.
Performance
This removes one GetAppPreferences call per add request that carries paused. No new work, so no benchmark.
Checklist
My PR title follows the Conventional Commits format (it becomes the squashed commit message)
If this changes the database schema, I have added migrations for both SQLite and PostgreSQL
Yes. Claude Code (Claude Opus) wrote the code and the test from the issue brief. DeepSeek and Qwen reviewed the diff. I checked that the test fails without the fix and ran go test -count=1 ./internal/api/handlers/, golangci-lint (0 issues), go fix -diff, gofmt and go build ./....
Reviewing files that changed from the base of the PR and between dfda84e4b6d83494ec579368b13347255537b641 and e1659db48bd7b82a8fe05740b2e0bcbca9b2ad6d.
📒 Files selected for processing: 2
internal/api/handlers/torrents.go
internal/api/handlers/torrents_add_test.go
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.
📝 Walkthrough
AddTorrent now sets both paused and stopped from a supplied paused form value. Only the exact value "true" maps to true. If the field is absent, both options remain unset. The handler no longer fetches app preferences to determine these options. Tests cover both values, the absent-field case, and the lack of a preferences lookup.
Priority: ➖ Normal
Severity of issue fixed: Medium
Merge Risk:⚪ Minimal · up to e1659
The handler is reported to send an explicitly requested paused state and leave it unset when omitted. No actionable issue remains before merge beyond normal validation.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Codex Review Summary
This comment shows the latest Codex review activity on this pull request.
e1659dbℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.