Skip to content

Commit 03a9c02

Browse files
committed
fix(linky): handle the double quote character in email addresses
Handle the double quote character as part of the domain in email addresses Closes angular#8945
1 parent e322cd9 commit 03a9c02

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/ngSanitize/filter/linky.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {
142142
html.push('" ');
143143
}
144144
html.push('href="');
145-
html.push(url);
145+
html.push(url.replace('"', '"'));
146146
html.push('">');
147147
addText(text);
148148
html.push('</a>');

test/ngSanitize/filter/linkySpec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ describe('linky', function() {
2929
toEqual('my email is &#34;<a href="mailto:[email protected]">[email protected]</a>&#34;');
3030
});
3131

32+
it('should handle quotes in the email', function() {
33+
expect(linky('foo@"bar.com')).toEqual('<a href="mailto:foo@&#34;bar.com">foo@&#34;bar.com</a>');
34+
});
35+
3236
it('should handle target:', function() {
3337
expect(linky("http://example.com", "_blank")).
3438
toEqual('<a target="_blank" href="http://example.com">http://example.com</a>');

0 commit comments

Comments
 (0)