Skip to content

Commit

Permalink
Merge pull request #1025 from macbookandrew/bugfix/autolinker-www-wit…
Browse files Browse the repository at this point in the history
…h-later-links

UrlAutolinkParser fails for text containing WWW and a subsequent link
  • Loading branch information
colinodell authored Jul 22, 2024
2 parents 9a2195d + 4140334 commit fd45b92
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Extension/Autolink/UrlAutolinkParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ final class UrlAutolinkParser implements InlineParserInterface
*
* @psalm-readonly
*/
private array $prefixes = ['www'];
private array $prefixes = ['www.'];

/**
* @psalm-var non-empty-string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public static function dataProviderForAutolinkTests(): iterable
yield ['(www.google.com/search?q=Markup+(business)', '<p>(<a href="http://www.google.com/search?q=Markup+(business)">www.google.com/search?q=Markup+(business)</a></p>'];
yield ['www.google.com/search?q=(business))+ok', '<p><a href="http://www.google.com/search?q=(business))+ok">www.google.com/search?q=(business))+ok</a></p>'];
yield ['(https://www.example.com/test).', '<p>(<a href="https://www.example.com/test">https://www.example.com/test</a>).</p>'];
yield ['WWW text followed by a [link](https://example.com/foo-bar-test)', '<p>WWW text followed by a <a href="https://example.com/foo-bar-test">link</a></p>'];

// Tests involving semi-colon endings
yield ['www.google.com/search?q=commonmark&hl=en', '<p><a href="http://www.google.com/search?q=commonmark&amp;hl=en">www.google.com/search?q=commonmark&amp;hl=en</a></p>'];
Expand Down

0 comments on commit fd45b92

Please sign in to comment.