mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-07 03:56:57 +03:00
fix for #2036
This commit is contained in:
@@ -898,3 +898,33 @@ const char* get404(void) {
|
||||
" You could try your <a href=index.html target=_parent>luck</a> here!</pre>\n"
|
||||
"<script>document.cookie = \"page=overview.html\"</script>"; // Make sure we load the overview page
|
||||
}
|
||||
|
||||
|
||||
std::string UrlDecode(const std::string& value)
|
||||
{
|
||||
std::string result;
|
||||
result.reserve(value.size());
|
||||
|
||||
for (std::size_t i = 0; i < value.size(); ++i)
|
||||
{
|
||||
auto ch = value[i];
|
||||
|
||||
if (ch == '%' && (i + 2) < value.size())
|
||||
{
|
||||
auto hex = value.substr(i + 1, 2);
|
||||
auto dec = static_cast<char>(std::strtol(hex.c_str(), nullptr, 16));
|
||||
result.push_back(dec);
|
||||
i += 2;
|
||||
}
|
||||
else if (ch == '+')
|
||||
{
|
||||
result.push_back(' ');
|
||||
}
|
||||
else
|
||||
{
|
||||
result.push_back(ch);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -93,4 +93,7 @@ std::string getFormatedUptime(bool compact);
|
||||
|
||||
const char* get404(void);
|
||||
|
||||
|
||||
std::string UrlDecode(const std::string& value);
|
||||
|
||||
#endif //HELPER_H
|
||||
|
||||
Reference in New Issue
Block a user