Fix Message Components for Tags with Attributes

Don't assume that the close tag is the length of the start tag +1

BUG: 482331
This commit is contained in:
James Graham
2024-03-24 10:01:00 +00:00
parent a1aa0804e2
commit 1dcfd94328
2 changed files with 16 additions and 2 deletions

View File

@@ -307,13 +307,14 @@ int TextHandler::nextBlockPos(const QString &string)
return string.size();
}
int closeTagPos = string.indexOf(QStringLiteral("</%1>").arg(tagType));
const auto closeTag = QStringLiteral("</%1>").arg(tagType);
int closeTagPos = string.indexOf(closeTag);
// If the close tag can't be found assume malformed html and process as single block.
if (closeTagPos == -1) {
return string.size();
}
return closeTagPos + tag.size() + 1;
return closeTagPos + closeTag.size();
}
MessageComponent TextHandler::nextBlock(const QString &string,