Skip to content

Commit 931761d

Browse files
committed
fix(linky): better handle punctuation
Fixes issue angular#15907
1 parent d0622d0 commit 931761d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/ngSanitize/filter/linky.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
*/
130130
angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {
131131
var LINKY_URL_REGEXP =
132-
/((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"\u201d\u2019]/i,
132+
/((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;:,(){}<>"\u201d\u2019]/i,
133133
MAILTO_REGEXP = /^mailto:/i;
134134

135135
var linkyMinErr = angular.$$minErr('linky');

test/ngSanitize/filter/linkySpec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ describe('linky', function() {
6464
expect(linky('www.example.com')).toEqual('<a href="http://www.example.com">www.example.com</a>');
6565
});
6666

67+
it('should handle punctuation', function() {
68+
expect(linky('www.example.com):')).toEqual('<a href="http://www.example.com">www.example.com</a>):');
69+
expect(linky('(www.example.com).')).toEqual('(<a href="http://www.example.com">www.example.com</a>).');
70+
});
71+
6772
it('should handle mailto:', function() {
6873
expect(linky('mailto:[email protected]')).
6974
toEqual('<a href="mailto:[email protected]">[email protected]</a>');

0 commit comments

Comments
 (0)