#3308

Editing a category save path clears its download path on qBittorrent 5.2 and earlier

Opengithub-actions[bot]opened 12d ago

This was generated by AI during triage.

Agent Brief

Category: bug Summary: Editing the save path of a category in qui clears the download path of that category on qBittorrent 5.2 and earlier.

Current behavior: SyncManager.EditCategory() calls go-qbittorrent EditCategoryCtx(ctx, name, savePath), which posts only category and savePath to /api/v2/torrents/editCategory. On qBittorrent 5.2 and earlier, editCategory replaces every option of the category with what the request carries, so the download path (incomplete folder) of the category resets to inherit (download_path: null). When the qBittorrent option "When Category Save Path changed" is "Relocate affected torrents", the auto-managed torrents of the category lose their download path too. Both callers hit it: the category edit endpoint (PUT /api/instances/{id}/categories) and backup restore of a category save path. qBittorrent 5.3+ treats the edit as partial and keeps the download path. The reporter reproduced it on 5.1.4 and 5.2.4, and not on 5.4.0alpha1.

Desired behavior: An edit of the save path keeps the current download path setting of the category (enabled with a path, disabled, or inherit) on every qBittorrent version. The edit sends the current downloadPathEnabled / downloadPath of the category along with the new savePath. A category with an inherited download path stays inherited. The share limit reset on 5.2 is out of reach, because the 5.2 WebAPI cannot set share limits (#2266).

Key interfaces:

  • go-qbittorrent EditCategoryCtx / its category options: need a way to send downloadPathEnabled and downloadPath (proposed in autobrr/go-qbittorrent#162).
  • SyncManager.EditCategory(): reads the current download path of the category from the synced category state and sends it with the edit, so both the API handler and backup restore get the fix.

Acceptance criteria:

  • On qBittorrent 5.2, editing the save path of a category with a custom download path keeps that download path.
  • A category whose download path is inherited stays inherited after the edit.
  • A category whose download path is explicitly disabled stays disabled after the edit.
  • Backup restore of a category save path keeps the download path of the category.
  • Behavior on qBittorrent 5.3+ is unchanged.

Out of scope:

  • Setting the download path of a category from the category dialog (#2125).
  • Category share limits (#2266).
  • The proxy editCategory pass-through, which forwards the form of the client unchanged.

Domain:

  • Glossary terms: category save path and category download path are not in GLOSSARY.md; gap.
  • ADRs: None.
  • Owner: SyncManager.EditCategory() in internal/qbittorrent.

Logs:

  • None

Why a human: The fix needs a go-qbittorrent change (autobrr/go-qbittorrent#162) reviewed, merged, and bumped in qui first. The reporter offered to send the qui side after that.

From discussion #3307

Activity

1
com605610d ago

I'll take this one! It needs the download path field from autobrr/go-qbittorrent#162 first, so I'll open the PR once that's in. The folder cleanup follow-up from #3120 uses the same field and will come as its own PR after it.