From 5d45fe065778b1564618a623cca19d12621b72ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Sat, 8 May 2010 19:48:49 +0200 Subject: Fixed linkify bug. Resolves: #326 diff --git a/SwifTools/Linkify.cpp b/SwifTools/Linkify.cpp index 483a08f..84ee73d 100644 --- a/SwifTools/Linkify.cpp +++ b/SwifTools/Linkify.cpp @@ -10,7 +10,7 @@ namespace Swift { -static const boost::regex linkifyRegexp("(https?://([\\-\\w\\.]+)+(:\\d+)?(/([%~\\-\\w/_#\\.\\+]*(\\?\\S+)?)?)?)"); +static const boost::regex linkifyRegexp("(https?://([@:\\-\\w\\.]+)+(:\\d+)?(/([%~\\-\\w/_#\\.\\+]*(\\?\\S+)?)?)?)"); String Linkify::linkify(const String& input) { return String(boost::regex_replace( diff --git a/SwifTools/UnitTest/LinkifyTest.cpp b/SwifTools/UnitTest/LinkifyTest.cpp index 7ca921e..332d167 100644 --- a/SwifTools/UnitTest/LinkifyTest.cpp +++ b/SwifTools/UnitTest/LinkifyTest.cpp @@ -23,6 +23,7 @@ class LinkifyTest : public CppUnit::TestFixture { CPPUNIT_TEST(testLinkify_Anchor); CPPUNIT_TEST(testLinkify_Plus); CPPUNIT_TEST(testLinkify_Tilde); + CPPUNIT_TEST(testLinkify_Authentication); CPPUNIT_TEST_SUITE_END(); public: @@ -106,6 +107,14 @@ class LinkifyTest : public CppUnit::TestFixture { String("http://foo.com/~kev/"), result); } + + void testLinkify_Authentication() { + String result = Linkify::linkify("http://bob:bla@swift.im/foo/bar"); + + CPPUNIT_ASSERT_EQUAL( + String("http://bob:bla@swift.im/foo/bar"), + result); + } }; CPPUNIT_TEST_SUITE_REGISTRATION(LinkifyTest); -- cgit v0.10.2-6-g49f6