From b8aa124f6baa0c0a32ccfd7479fa1e6f0dff3487 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Mon, 23 Nov 2009 18:41:17 +0100
Subject: Fix linkifying links with '+'.


diff --git a/SwifTools/Linkify.cpp b/SwifTools/Linkify.cpp
index 7fa8c91..63f06c8 100644
--- a/SwifTools/Linkify.cpp
+++ b/SwifTools/Linkify.cpp
@@ -4,7 +4,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 b31bbfe..6c5fb15 100644
--- a/SwifTools/UnitTest/LinkifyTest.cpp
+++ b/SwifTools/UnitTest/LinkifyTest.cpp
@@ -15,6 +15,7 @@ class LinkifyTest : public CppUnit::TestFixture {
 		CPPUNIT_TEST(testLinkify_CamelCase);
 		CPPUNIT_TEST(testLinkify_HierarchicalResource);
 		CPPUNIT_TEST(testLinkify_Anchor);
+		CPPUNIT_TEST(testLinkify_Plus);
 		CPPUNIT_TEST_SUITE_END();
 
 	public:
@@ -82,6 +83,14 @@ class LinkifyTest : public CppUnit::TestFixture {
 					String("<a href=\"http://foo.com/bar#baz\">http://foo.com/bar#baz</a>"),
 					result);
 		}
+
+		void testLinkify_Plus() {
+			String result = Linkify::linkify("http://foo.com/bar+baz");
+
+			CPPUNIT_ASSERT_EQUAL(
+					String("<a href=\"http://foo.com/bar+baz\">http://foo.com/bar+baz</a>"),
+					result);
+		}
 };
 
 CPPUNIT_TEST_SUITE_REGISTRATION(LinkifyTest);
-- 
cgit v0.10.2-6-g49f6