fix themezer

This commit is contained in:
ITotalJustice
2025-04-18 13:16:17 +01:00
parent 252cd0cee6
commit e243d5b64e
3 changed files with 17 additions and 2 deletions

View File

@@ -87,6 +87,9 @@ auto ToFile(const Api& e) -> ApiResult;
auto ToMemoryAsync(const Api& e) -> bool; auto ToMemoryAsync(const Api& e) -> bool;
auto ToFileAsync(const Api& e) -> bool; auto ToFileAsync(const Api& e) -> bool;
// uses curl to convert string to their %XX
auto EscapeString(const std::string& str) -> std::string;
struct Api { struct Api {
Api() = default; Api() = default;

View File

@@ -757,4 +757,14 @@ auto ToFileAsync(const Api& e) -> bool {
return g_thread_queue.Add(e); return g_thread_queue.Add(e);
} }
auto EscapeString(const std::string& str) -> std::string {
std::string result;
const auto s = curl_escape(str.data(), str.length());
if (s) {
result = s;
curl_free(s);
}
return result;
}
} // namespace sphaira::curl } // namespace sphaira::curl

View File

@@ -92,7 +92,9 @@ auto apiBuildUrlListInternal(const Config& e, bool is_pack) -> std::string {
json += ",\"query\":\"" + e.query + "\""; json += ",\"query\":\"" + e.query + "\"";
} }
return api+"("+p0+"){"+cmd+"("+p1+")"+fields+"}}&variables={"+json+"}"; json = curl::EscapeString('{'+json+'}');
return api+"("+p0+"){"+cmd+"("+p1+")"+fields+"}}&variables="+json;
} }
auto apiBuildUrlDownloadInternal(const std::string& id, bool is_pack) -> std::string { auto apiBuildUrlDownloadInternal(const std::string& id, bool is_pack) -> std::string {