in src/authentication/html_util.cc [32:60]
std::string HtmlUtil::EscapeHtmlEntity(const std::string& html) {
std::string retval;
DLOG(INFO) << "Before HTML escape modification: " << html;
int i = 0;
int length = html.length();
while (i < length) {
char c = html[i];
if (c != '&') {
retval.append(1, c);
i++;
continue;
}
size_t semicolon_idx = html.find(';', i);
if (semicolon_idx != std::string::npos) {
std::string html_code = html.substr(i, semicolon_idx - i + 1);
if (auto itr = HtmlUtil::HTML_DECODE_MAP.find(html_code); itr != HtmlUtil::HTML_DECODE_MAP.end()) {
retval.append(1, itr->second);
i = semicolon_idx + 1;
}
} else {
retval.append(1, c);
i++;
}
}
DLOG(INFO) << "After HTML escape modification: " << html;
return retval;
}