From c60ae9c8bb9ed48bdec9e472b3397ed491ffc583 Mon Sep 17 00:00:00 2001 From: Thomas Piccirello Date: Fri, 27 Jun 2025 22:29:19 -0700 Subject: [PATCH 1/2] Modify `CategoryOptions` serialization to JSON When a category's download path option is set to "Default", its `downloadPath` is serialized into JSON as `undefined`. This results in the `downloadPath` field being omitted from `torrents/categories` and `torrents/maindata` payloads (as is expected with an `undefined` value). The use of `undefined` here causes an issue in the WebUI. Specifically, when the category previously contained a value for this field (i.e. download path option set to either "Yes" or "No"), the `processMap` logic in `SyncController` does not detect the removal this field. This results in the category's new `downloadPath` not being properly sent to the client. By switching from `undefined` to `null`, we ensure that the `downloadPath` value is always included in the category's payload. This allows `processMap` to properly detect whenever the value changes. This change is backwards compatible with existing categories.json files. Older qBittorrent versions should also be able to parse new categories.json files containing `null`. --- src/base/bittorrent/categoryoptions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/bittorrent/categoryoptions.cpp b/src/base/bittorrent/categoryoptions.cpp index fec609ff7..c839670c6 100644 --- a/src/base/bittorrent/categoryoptions.cpp +++ b/src/base/bittorrent/categoryoptions.cpp @@ -52,7 +52,7 @@ BitTorrent::CategoryOptions BitTorrent::CategoryOptions::fromJSON(const QJsonObj QJsonObject BitTorrent::CategoryOptions::toJSON() const { - QJsonValue downloadPathValue = QJsonValue::Undefined; + QJsonValue downloadPathValue = QJsonValue::Null; if (downloadPath) { if (downloadPath->enabled) From a31fffac4f40e635967e0afdddc5234eb0870fac Mon Sep 17 00:00:00 2001 From: Thomas Piccirello Date: Fri, 27 Jun 2025 23:10:56 -0700 Subject: [PATCH 2/2] Bump WebAPI version --- WebAPI_Changelog.md | 5 +++++ src/webui/webapplication.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/WebAPI_Changelog.md b/WebAPI_Changelog.md index 375e24d69..4dd39c4a8 100644 --- a/WebAPI_Changelog.md +++ b/WebAPI_Changelog.md @@ -1,5 +1,10 @@ # WebAPI Changelog +## 2.11.10 + +* [#22932](https://github.com/qbittorrent/qBittorrent/pull/22932) + * `torrents/categories` and `sync/maindata` now serialize categories' `downloadPath` to `null`, rather than `undefined` + ## 2.11.9 * [#21015](https://github.com/qbittorrent/qBittorrent/pull/21015) diff --git a/src/webui/webapplication.h b/src/webui/webapplication.h index 6ceb28593..2098e3635 100644 --- a/src/webui/webapplication.h +++ b/src/webui/webapplication.h @@ -53,7 +53,7 @@ #include "base/utils/version.h" #include "api/isessionmanager.h" -inline const Utils::Version<3, 2> API_VERSION {2, 11, 9}; +inline const Utils::Version<3, 2> API_VERSION {2, 11, 10}; class APIController; class AuthController;