From 0c738c4f8bd820519a4b46b27f419dbc921721f5 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 17 Mar 2019 19:37:26 -0400 Subject: [PATCH 1/2] Exclude punctuation from domain in autolinker regular expression --- src/Util/Strings.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Util/Strings.php b/src/Util/Strings.php index 681edb1c87..d6583b9c61 100644 --- a/src/Util/Strings.php +++ b/src/Util/Strings.php @@ -361,7 +361,10 @@ class Strings ( # Capture 1: entire matched URL https?:// # http or https protocol (?: - [^/\s.][^/\s]+[.][^\s/]+/? # looks like domain name followed by a slash + [^/\s`!()\[\]{};:\'",<>?«»“”‘’.] # Domain can\'t start with a . + [^/\s`!()\[\]{};:\'",<>?«»“”‘’]+ # Domain can\'t end with a . + \. + [^/\s`!()\[\]{};:\'".,<>?«»“”‘’]+/? # Followed by a slash ) (?: # One or more: [^\s()<>]+ # Run of non-space, non-()<> From 58a9a319c5de8ed733c607977f1e84582b500e36 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 17 Mar 2019 22:36:03 -0400 Subject: [PATCH 2/2] Add test for bug --- tests/src/Content/Text/BBCodeTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/src/Content/Text/BBCodeTest.php b/tests/src/Content/Text/BBCodeTest.php index 2f9a244ccc..7fd39927fc 100644 --- a/tests/src/Content/Text/BBCodeTest.php +++ b/tests/src/Content/Text/BBCodeTest.php @@ -102,6 +102,10 @@ class BBCodeTest extends MockedTest 'data' => "http://example.com\ntest", 'assertHTML' => false ], + 'bug-6901' => [ + 'data' => "http://example.com