WebAPI: fix wrong key used for categories

Regression from 1c0f8b4289.
Closes #15969.
This commit is contained in:
Chocobo1 2022-01-11 11:54:15 +08:00 committed by GitHub
parent 83b34053a1
commit d7fd576293
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 1 deletions

View file

@ -503,6 +503,8 @@ void SyncController::maindataAction()
{
const BitTorrent::CategoryOptions categoryOptions = session->categoryOptions(categoryName);
QJsonObject category = categoryOptions.toJSON();
// adjust it to be compatible with exisitng WebAPI
category[QLatin1String("savePath")] = category.take(QLatin1String("save_path"));
category.insert(QLatin1String("name"), categoryName);
categories[categoryName] = category.toVariantMap();
}

View file

@ -1285,6 +1285,8 @@ void TorrentsController::categoriesAction()
{
const BitTorrent::CategoryOptions categoryOptions = session->categoryOptions(categoryName);
QJsonObject category = categoryOptions.toJSON();
// adjust it to be compatible with exisitng WebAPI
category[QLatin1String("savePath")] = category.take(QLatin1String("save_path"));
category.insert(QLatin1String("name"), categoryName);
categories[categoryName] = category;
}

View file

@ -43,7 +43,7 @@
#include "base/utils/net.h"
#include "base/utils/version.h"
inline const Utils::Version<int, 3, 2> API_VERSION {2, 8, 4};
inline const Utils::Version<int, 3, 2> API_VERSION {2, 8, 5};
class APIController;
class WebApplication;