diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-08-19 16:18:46 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-08-19 16:18:46 (GMT) |
commit | b44ed4b36505ece31f29cdd0803af9949463f94b (patch) | |
tree | b0871fbd5d2a8544379ff8349a98dbddb5561ee2 /SwifTools | |
parent | e1f9cdc38b600d930760ed0e0b867ab739127f5a (diff) | |
download | swift-contrib-b44ed4b36505ece31f29cdd0803af9949463f94b.zip swift-contrib-b44ed4b36505ece31f29cdd0803af9949463f94b.tar.bz2 |
Fixed linkifying of urls containing '='.
Diffstat (limited to 'SwifTools')
-rw-r--r-- | SwifTools/Linkify.cpp | 2 | ||||
-rw-r--r-- | SwifTools/UnitTest/LinkifyTest.cpp | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/SwifTools/Linkify.cpp b/SwifTools/Linkify.cpp index 84ee73d..a122695 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 332d167..afaac60 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_Equal); CPPUNIT_TEST(testLinkify_Authentication); CPPUNIT_TEST_SUITE_END(); @@ -108,6 +109,14 @@ class LinkifyTest : public CppUnit::TestFixture { result); } + void testLinkify_Equal() { + String result = Linkify::linkify("http://www.amazon.co.uk/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=xmpp+definitive+guide&x=0&y=0"); + + CPPUNIT_ASSERT_EQUAL( + String("<a href=\"http://www.amazon.co.uk/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=xmpp+definitive+guide&x=0&y=0\">http://www.amazon.co.uk/s/ref=nb_sb_noss?url=search-alias%3Daps&field-keywords=xmpp+definitive+guide&x=0&y=0</a>"), + result); + } + void testLinkify_Authentication() { String result = Linkify::linkify("http://bob:bla@swift.im/foo/bar"); |