aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Matrix.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/Matrix.cpp')
-rw-r--r--src/plugins/Matrix.cpp16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 3637d41..a0d8568 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -1730,22 +1730,12 @@ namespace QuickMedia {
}
DownloadResult Matrix::download_json(rapidjson::Document &result, const std::string &url, std::vector<CommandArg> additional_args, bool use_browser_useragent, std::string *err_msg) const {
- std::string server_response;
- if(download_to_string(url, server_response, std::move(additional_args), use_tor, use_browser_useragent, err_msg == nullptr) != DownloadResult::OK) {
+ if(download_to_json(url, result, std::move(additional_args), use_tor, use_browser_useragent, err_msg == nullptr) != DownloadResult::OK) {
+ // Cant get error since we parse directory to json. TODO: Make this work somehow?
if(err_msg)
- *err_msg = server_response;
+ *err_msg = "Failed to download/parse json";
return DownloadResult::NET_ERR;
}
-
- rapidjson::ParseResult parse_result = result.Parse(server_response.c_str(), server_response.size());
- if(parse_result.IsError()) {
- std::string error_code_str = std::to_string(parse_result.Code());
- fprintf(stderr, "download_json error: %s\n", error_code_str.c_str());
- if(err_msg)
- *err_msg = "Json parse error: " + std::move(error_code_str);
- return DownloadResult::ERR;
- }
-
return DownloadResult::OK;
}
} \ No newline at end of file