Properly escape user messages (fix popup error)
This commit is contained in:
@@ -102,3 +102,18 @@ bufferToString(const std::vector<unsigned char>& data)
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
std::string
|
||||
replaceInString(std::string str, const std::string& from, const std::string& to)
|
||||
{
|
||||
size_t pos = 0;
|
||||
|
||||
while ((pos = str.find(from, pos)) != std::string::npos)
|
||||
{
|
||||
str.replace(pos, from.length(), to);
|
||||
pos += to.length();
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -60,3 +60,6 @@ boost::optional<T> readAs(const std::string& str)
|
||||
return res;
|
||||
}
|
||||
|
||||
std::string
|
||||
replaceInString(std::string str, const std::string& from, const std::string& to);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user