mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Fix parsing ampersands in server listings for streaming
Fixes #16263 , or so I hope - haven't actually tested it, but seems straightforward enough.
This commit is contained in:
parent
10c6232b9b
commit
675a046759
1 changed files with 20 additions and 1 deletions
|
@ -286,6 +286,25 @@ void SplitString(const std::string& str, const char delim, std::vector<std::stri
|
|||
}
|
||||
}
|
||||
|
||||
static std::string ApplyHtmlEscapes(std::string str) {
|
||||
struct Repl {
|
||||
const char *a;
|
||||
const char *b;
|
||||
};
|
||||
|
||||
static const Repl replacements[] = {
|
||||
{ "&", "&" },
|
||||
// Easy to add more cases.
|
||||
};
|
||||
|
||||
for (const Repl &r : replacements) {
|
||||
str = ReplaceAll(str, r.a, r.b);
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
// Meant for HTML listings and similar, so supports some HTML escapes.
|
||||
void GetQuotedStrings(const std::string& str, std::vector<std::string>& output)
|
||||
{
|
||||
size_t next = 0;
|
||||
|
@ -294,7 +313,7 @@ void GetQuotedStrings(const std::string& str, std::vector<std::string>& output)
|
|||
if (str[pos] == '\"' || str[pos] == '\'') {
|
||||
if (even) {
|
||||
//quoted text
|
||||
output.emplace_back(str.substr(next, pos - next));
|
||||
output.emplace_back(ApplyHtmlEscapes(str.substr(next, pos - next)));
|
||||
even = 0;
|
||||
} else {
|
||||
//non quoted text
|
||||
|
|
Loading…
Add table
Reference in a new issue