whitespace in links end fix(2)

master
const an teen 2022-01-01 14:41:37 -05:00
parent 84b9e48f7d
commit d9d1c5ba74
1 changed files with 3 additions and 1 deletions

View File

@ -85,7 +85,9 @@ std::pair<QString, QString> HttpServer::splitUserNameAndMessage(const QString &r
text = text.toHtmlEscaped();
// http links
bool linksFound {false};
while (QRegularExpression("(^|\\s)http.?://").match(text).hasMatch()) {
if (not linksFound) linksFound = true;
int pos = text.indexOf(QRegularExpression("(^|\\s)http.?://"));
if (pos == -1) {
consoleLog("Bug! HttpServer.cpp while (QRegularExpression(\"(^|\\s)http.?://\").match(text).hasMatch())");
@ -102,7 +104,7 @@ std::pair<QString, QString> HttpServer::splitUserNameAndMessage(const QString &r
}
text.replace(rawLink, convertToClickableLink(rawLink));
}
text.replace(" </a>", "</a>"); // delete whitespace in links end
if (linksFound) text.replace(" </a>", "</a>"); // delete whitespace in links end
// long lines
int space = 0;