Browse Source

Don't allow tags over 10 characters long to allow javascript to be able to use less than and greater than

master
Odilitime 2 years ago
parent
commit
c3f507ac4f
1 changed files with 9 additions and 0 deletions
  1. 9
    0
      src/parsers/markup/html/HTMLParser.cpp

+ 9
- 0
src/parsers/markup/html/HTMLParser.cpp View File

@@ -224,6 +224,15 @@ std::shared_ptr<Node> HTMLParser::parse(const std::string &html) const {
}
else if (state == 3) { // End text node
if (html[cursor + 1] == '<') {
// find next space
std::string left = html.substr(cursor);
size_t end = std::min(left.find(" "), left.find(">"));
if (end != std::string::npos) {
if (end > 14) {
//std::cout << "Tag Distance [" << end << "] [" << html.substr(cursor, end) << "]\n";
continue;
}
}
dynamic_cast<TextNode*>(currentNode.get())->text = (prependWhiteSpace?" ":"") + html.substr(starts.back(), cursor - starts.back() + 1);
//std::cout << "HTMLParser::parse - end text node: " << html.substr(starts.back(), cursor - starts.back() + 1) << std::endl;
starts.pop_back();

Loading…
Cancel
Save