diff --git a/CHANGELOG.md b/CHANGELOG.md index 80fde95..e168cde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change log +## 1.7.4 + +- 💊 Fixing URL encoding issues + ## 1.7.3 - 🎁 Improve menu structure, adding "Reset time & date" diff --git a/src/WettergeraetDesktop/Frame.cpp b/src/WettergeraetDesktop/Frame.cpp index a23ee56..a306a54 100644 --- a/src/WettergeraetDesktop/Frame.cpp +++ b/src/WettergeraetDesktop/Frame.cpp @@ -456,17 +456,12 @@ void Frame::actionFetch(wxCommandEvent& WXUNUSED(event)) return; } - auto date = this->utcDateInput->GetValue().FormatISODate().mb_str().data(); - auto time = this->utcTimeInput->GetValue().FormatISOTime().mb_str().data(); - - // yyyy-mm-ddThh:mm:ssZ - char searchDate[25]; - sprintf( - searchDate, - "%sT%sZ", - date, - time - ); + auto searchDate = this->utcDateInput->GetValue().FormatISODate().ToStdString() + .append("T") + .append( + this->utcTimeInput->GetValue().FormatISOTime().ToStdString() + ) + .append("Z"); this->metarInput->SetValue("Loading..."); FetchUrl urlFetcher; diff --git a/src/WettergeraetLib/Argumentor.cpp b/src/WettergeraetLib/Argumentor.cpp index 338ffd3..1ed6c17 100644 --- a/src/WettergeraetLib/Argumentor.cpp +++ b/src/WettergeraetLib/Argumentor.cpp @@ -3,7 +3,7 @@ #include #include -const char* Argumentor::APP_VERSION = "1.7.3"; +const char* Argumentor::APP_VERSION = "1.7.4"; #if _WIN64 const char* Argumentor::APP_TARGET = "64-bit"; #else diff --git a/src/WettergeraetLib/FetchUrl.cpp b/src/WettergeraetLib/FetchUrl.cpp index a0ba29e..46344f5 100644 --- a/src/WettergeraetLib/FetchUrl.cpp +++ b/src/WettergeraetLib/FetchUrl.cpp @@ -106,7 +106,7 @@ std::string FetchUrl::fetch(std::string url, unsigned short fetchMode, std::stri throw std::invalid_argument("Timeout for " + url); } else if (res != CURLE_OK) { - throw std::invalid_argument(curl_easy_strerror(res)); + throw std::invalid_argument(std::string(curl_easy_strerror(res)) + ": " + url); } if (fetchMode == FetchUrl::MODE_JSON) { @@ -129,10 +129,11 @@ std::string FetchUrl::fetch(std::string url, std::string icaoCode, std::string d std::regex("[^a-zA-z0-9]"), "" ); + date = std::regex_replace( date, std::regex(":"), - std::string("%3A") + std::string("%%3A") ); if (lowercase) { transform(icaoCode.begin(), icaoCode.end(), icaoCode.begin(), ::tolower);