File Fix-bug-401996.patch of Package kcoreaddons
From 7e96b4cee76ba7de73b2e69bfe79c25f8afa5ea9 Mon Sep 17 00:00:00 2001
From: Laurent Montel <montel@kde.org>
Date: Fri, 5 Apr 2019 08:11:41 +0200
Subject: Fix Bug 401996 - clicking contact web url => uncomplete url is
selected
(Fixed in kcoreaddons)
BUG: 401996
FIXED-IN: 5.57.0
---
autotests/kstringhandlertest.cpp | 8 ++++++++
src/lib/text/kstringhandler.cpp | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/autotests/kstringhandlertest.cpp b/autotests/kstringhandlertest.cpp
index f48b639..d0f6a26 100644
--- a/autotests/kstringhandlertest.cpp
+++ b/autotests/kstringhandlertest.cpp
@@ -31,6 +31,14 @@ void KStringHandlerTest::tagURLs()
check("tagURLs()", KStringHandler::tagURLs(test),
"<a href=<a href=\"www.foo.com\">www.foo.com</a>>");
#endif
+
+ test = QStringLiteral("http://www.foo.org/bla-(bli)");
+ QCOMPARE(KStringHandler::tagUrls(test),
+ QStringLiteral("<a href=\"http://www.foo.org/bla-(bli)\">http://www.foo.org/bla-(bli)</a>"));
+
+ test = QStringLiteral("http://www.foo.org/bla-bli");
+ QCOMPARE(KStringHandler::tagUrls(test),
+ QStringLiteral("<a href=\"http://www.foo.org/bla-bli\">http://www.foo.org/bla-bli</a>"));
}
void KStringHandlerTest::perlSplit()
diff --git a/src/lib/text/kstringhandler.cpp b/src/lib/text/kstringhandler.cpp
index cd0a837..a2002bb 100644
--- a/src/lib/text/kstringhandler.cpp
+++ b/src/lib/text/kstringhandler.cpp
@@ -166,7 +166,7 @@ QStringList KStringHandler::perlSplit(const QRegExp &sep, const QString &s, int
QString KStringHandler::tagUrls(const QString &text)
{
- /*static*/ QRegExp urlEx(QStringLiteral("(www\\.(?!\\.)|(fish|(f|ht)tp(|s))://)[\\d\\w\\./,:_~\\?=&;#@\\-\\+\\%\\$]+[\\d\\w/]"));
+ /*static*/ QRegExp urlEx(QStringLiteral("(www\\.(?!\\.)|(fish|(f|ht)tp(|s))://)[\\d\\w\\./,:_~\\?=&;#@\\-\\+\\%\\$\\(]+[\\d\\w/\\)]"));
QString richText(text);
int urlPos = 0, urlLen;
--
cgit v1.1