Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit a9d2271

Browse files
committed
fix(linky): handle quotes around email addresses
Closes #8520
1 parent 05791c0 commit a9d2271

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/ngSanitize/filter/linky.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
*/
105105
angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {
106106
var LINKY_URL_REGEXP =
107-
/((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>]/,
107+
/((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"]/,
108108
MAILTO_REGEXP = /^mailto:/;
109109

110110
return function(text, target) {

test/ngSanitize/filter/linkySpec.js

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ describe('linky', function() {
2525
toEqual('<a href="mailto:me@example.com">me@example.com</a>');
2626
expect(linky("send email to me@example.com, but")).
2727
toEqual('send email to <a href="mailto:me@example.com">me@example.com</a>, but');
28+
expect(linky("my email is \"me@example.com\"")).
29+
toEqual('my email is &#34;<a href="mailto:me@example.com">me@example.com</a>&#34;');
2830
});
2931

3032
it('should handle target:', function() {

0 commit comments

Comments
 (0)