mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-06 13:11:25 -07:00
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`.
This commit is contained in:
parent
5028f68d48
commit
c60ae9c8bb
1 changed files with 1 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue