From d9d1c5ba7463180dea77121bc5cbd9259fdb64bf Mon Sep 17 00:00:00 2001 From: acetone Date: Sat, 1 Jan 2022 14:41:37 -0500 Subject: [PATCH] whitespace in links end fix(2) --- httpserver.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/httpserver.cpp b/httpserver.cpp index 8cb9c22..ff66df4 100644 --- a/httpserver.cpp +++ b/httpserver.cpp @@ -85,7 +85,9 @@ std::pair 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 HttpServer::splitUserNameAndMessage(const QString &r } text.replace(rawLink, convertToClickableLink(rawLink)); } - text.replace(" ", ""); // delete whitespace in links end + if (linksFound) text.replace(" ", ""); // delete whitespace in links end // long lines int space = 0;