diff options
Diffstat (limited to 'src/curl_wrapper.cpp')
-rw-r--r-- | src/curl_wrapper.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/curl_wrapper.cpp b/src/curl_wrapper.cpp index bfa59ee..9341069 100644 --- a/src/curl_wrapper.cpp +++ b/src/curl_wrapper.cpp @@ -22,6 +22,7 @@ #include <algorithm> #include <array> #include <atomic> +#include <cctype> #include <cstdint> namespace mastodonpp @@ -30,8 +31,10 @@ namespace mastodonpp using std::get; using std::holds_alternative; using std::any_of; +using std::transform; using std::array; // NOLINT(misc-unused-using-decls) using std::atomic; +using std::toupper; using std::uint8_t; using std::uint16_t; @@ -355,13 +358,22 @@ bool CURLWrapper::replace_parameter_in_uri(string &uri, { static constexpr array replace { - "id", "nickname", "nickname_or_id", "account_id", - "list_id", "hashtag", "permission_group" + "id", "nickname", "nickname_or_id", "account_id", "list_id", + "hashtag", "permission_group", "instance", "report_id", "name", + "emoji" }; if (any_of(replace.begin(), replace.end(), [¶meter](const auto &s) { return s == parameter.first; })) { - const auto pos{uri.find('<')}; + const string searchstring{[¶meter] + { + string s{"<"}; + s += parameter.first; + transform(s.begin(), s.end(), s.begin(), + [](const unsigned char c){ return toupper(c); }); + return s; + }()}; + const auto pos{uri.find(searchstring)}; if (pos != string::npos) { uri.replace(pos, parameter.first.size() + 2, |