From 3bd779a607a315d3eef51e9d6f4c90d6661b983c Mon Sep 17 00:00:00 2001 From: WerWolv Date: Fri, 17 Nov 2023 13:13:17 +0100 Subject: [PATCH] fix: URL Decoding not working correctly --- lib/libimhex/include/hex/helpers/http_requests.hpp | 4 ++-- lib/libimhex/source/helpers/http_requests.cpp | 2 +- plugins/builtin/source/content/tools/wiki_explainer.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/libimhex/include/hex/helpers/http_requests.hpp b/lib/libimhex/include/hex/helpers/http_requests.hpp index 6f220e23e..01b5591af 100644 --- a/lib/libimhex/include/hex/helpers/http_requests.hpp +++ b/lib/libimhex/include/hex/helpers/http_requests.hpp @@ -118,9 +118,9 @@ namespace hex { template std::future> execute(); - std::string urlEncode(const std::string &input); + static std::string urlEncode(const std::string &input); - std::string urlDecode(const std::string &input); + static std::string urlDecode(const std::string &input); protected: void setDefaultConfig(); diff --git a/lib/libimhex/source/helpers/http_requests.cpp b/lib/libimhex/source/helpers/http_requests.cpp index e6681b515..5c53030c3 100644 --- a/lib/libimhex/source/helpers/http_requests.cpp +++ b/lib/libimhex/source/helpers/http_requests.cpp @@ -51,7 +51,7 @@ namespace hex { i += 2; } } - return input; + return result; } } \ No newline at end of file diff --git a/plugins/builtin/source/content/tools/wiki_explainer.cpp b/plugins/builtin/source/content/tools/wiki_explainer.cpp index 5e7501a08..44f0cfb94 100644 --- a/plugins/builtin/source/content/tools/wiki_explainer.cpp +++ b/plugins/builtin/source/content/tools/wiki_explainer.cpp @@ -39,7 +39,7 @@ namespace hex::plugin::builtin { ImGui::EndDisabled(); if (startSearch && !searchString.empty()) { - request.setUrl(getWikipediaApiUrl() + "&exintro"s + "&titles="s + request.urlEncode(searchString)); + request.setUrl(getWikipediaApiUrl() + "&exintro"s + "&titles="s + HttpRequest::urlEncode(searchString)); searchProcess = request.execute(); } @@ -66,7 +66,7 @@ namespace hex::plugin::builtin { if (!extendedSearch && resultExtract.ends_with(':')) { extendedSearch = true; - request.setUrl(getWikipediaApiUrl() + "&titles="s + request.urlEncode(searchString)); + request.setUrl(getWikipediaApiUrl() + "&titles="s + HttpRequest::urlEncode(searchString)); searchProcess = request.execute(); resultTitle.clear();