Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Improved parsing of AngularJS URLS.
The AngularJS URLS may contain ; and !, they broke (parsed partially).
  • Loading branch information
sevvlor committed Jun 1, 2017
1 parent 3977795 commit 9e8a9c1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/View/Helper/TextHelper.php
Expand Up @@ -123,7 +123,7 @@ public function autoLinkUrls($text, array $options = [])
(?<left>[\[<(]) # left paren,brace
(?>
# Lax match URL
(?<url>(?:https?|ftp|nntp):\/\/[\p{L}0-9.\-_:]+(?:[\/?][\p{L}0-9.\-_:\/?=&>\[\]()#@\+~%]+)?)
(?<url>(?:https?|ftp|nntp):\/\/[\p{L}0-9.\-_:]+(?:[\/?][\p{L}0-9.\-_:\/?=&>\[\]()#@\+~!;%]+)?)
(?<right>[\])>]) # right paren,brace
)
)
Expand Down
8 changes: 8 additions & 0 deletions tests/TestCase/View/Helper/TextHelperTest.php
Expand Up @@ -368,6 +368,14 @@ public static function autoLinkProvider()
[
'https://sevvlor.com/page%20not%20found',
'<a href="https://sevvlor.com/page%20not%20found">https://sevvlor.com/page%20not%20found</a>'
],
[
'https://fakedomain.ext/path/#!topic/test',
'<a href="https://fakedomain.ext/path/#!topic/test">https://fakedomain.ext/path/#!topic/test</a>'
],
[
'https://fakedomain.ext/path/#!topic/test;other;tag',
'<a href="https://fakedomain.ext/path/#!topic/test;other;tag">https://fakedomain.ext/path/#!topic/test;other;tag</a>'
]
];
}
Expand Down

0 comments on commit 9e8a9c1

Please sign in to comment.