From da459bb2c52b0857df2373f8c3d95299295c5607 Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Wed, 22 May 2024 11:48:05 -0500 Subject: [PATCH 1/3] add failing test --- tests/functional/Extension/Autolink/UrlAutolinkParserTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/functional/Extension/Autolink/UrlAutolinkParserTest.php b/tests/functional/Extension/Autolink/UrlAutolinkParserTest.php index 0057b68bfd..ddca1bcc71 100644 --- a/tests/functional/Extension/Autolink/UrlAutolinkParserTest.php +++ b/tests/functional/Extension/Autolink/UrlAutolinkParserTest.php @@ -71,6 +71,7 @@ public static function dataProviderForAutolinkTests(): iterable yield ['(www.google.com/search?q=Markup+(business)', '

(www.google.com/search?q=Markup+(business)

']; yield ['www.google.com/search?q=(business))+ok', '

www.google.com/search?q=(business))+ok

']; yield ['(https://www.example.com/test).', '

(https://www.example.com/test).

']; + yield ['WWW text followed by [link](https://example.com/)', '

WWW text followed by link

']; // Tests involving semi-colon endings yield ['www.google.com/search?q=commonmark&hl=en', '

www.google.com/search?q=commonmark&hl=en

']; From 6ab9ee07452b7ad8ad969fb01d9926aa309c67fa Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Wed, 22 May 2024 11:56:15 -0500 Subject: [PATCH 2/3] improve test to make breaking behavior more visible #1025 --- tests/functional/Extension/Autolink/UrlAutolinkParserTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/Extension/Autolink/UrlAutolinkParserTest.php b/tests/functional/Extension/Autolink/UrlAutolinkParserTest.php index ddca1bcc71..30ea154332 100644 --- a/tests/functional/Extension/Autolink/UrlAutolinkParserTest.php +++ b/tests/functional/Extension/Autolink/UrlAutolinkParserTest.php @@ -71,7 +71,7 @@ public static function dataProviderForAutolinkTests(): iterable yield ['(www.google.com/search?q=Markup+(business)', '

(www.google.com/search?q=Markup+(business)

']; yield ['www.google.com/search?q=(business))+ok', '

www.google.com/search?q=(business))+ok

']; yield ['(https://www.example.com/test).', '

(https://www.example.com/test).

']; - yield ['WWW text followed by [link](https://example.com/)', '

WWW text followed by link

']; + yield ['WWW text followed by a [link](https://example.com/foo-bar-test)', '

WWW text followed by a link

']; // Tests involving semi-colon endings yield ['www.google.com/search?q=commonmark&hl=en', '

www.google.com/search?q=commonmark&hl=en

']; From 41403348f06ddf13500757d4b54856a82a74af94 Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Wed, 22 May 2024 11:57:00 -0500 Subject: [PATCH 3/3] fix text containing www and following link #1025 --- src/Extension/Autolink/UrlAutolinkParser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Extension/Autolink/UrlAutolinkParser.php b/src/Extension/Autolink/UrlAutolinkParser.php index f44da3357e..0d8f6a97e4 100644 --- a/src/Extension/Autolink/UrlAutolinkParser.php +++ b/src/Extension/Autolink/UrlAutolinkParser.php @@ -56,7 +56,7 @@ final class UrlAutolinkParser implements InlineParserInterface * * @psalm-readonly */ - private array $prefixes = ['www']; + private array $prefixes = ['www.']; /** * @psalm-var non-empty-string