summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-05-08 17:48:49 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-05-08 17:48:49 (GMT)
commit5d45fe065778b1564618a623cca19d12621b72ca (patch)
tree572b5277d81018046b32286ccb425b88973ce7f4 /SwifTools
parent73ad73d896664a75e30063a6b96ed18a3b856786 (diff)
downloadswift-contrib-5d45fe065778b1564618a623cca19d12621b72ca.zip
swift-contrib-5d45fe065778b1564618a623cca19d12621b72ca.tar.bz2
Fixed linkify bug.
Resolves: #326
Diffstat (limited to 'SwifTools')
-rw-r--r--SwifTools/Linkify.cpp2
-rw-r--r--SwifTools/UnitTest/LinkifyTest.cpp9
2 files changed, 10 insertions, 1 deletions
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("<a href=\"http://foo.com/~kev/\">http://foo.com/~kev/</a>"),
result);
}
+
+ void testLinkify_Authentication() {
+ String result = Linkify::linkify("http://bob:bla@swift.im/foo/bar");
+
+ CPPUNIT_ASSERT_EQUAL(
+ String("<a href=\"http://bob:bla@swift.im/foo/bar\">http://bob:bla@swift.im/foo/bar</a>"),
+ result);
+ }
};
CPPUNIT_TEST_SUITE_REGISTRATION(LinkifyTest);