fix(linky): handle quotes around email addresses

Closes #8520
This commit is contained in:
Brian Ford
2014-08-19 16:07:13 -07:00
parent 64cdbf3ae9
commit effc98fdc9
2 changed files with 3 additions and 1 deletions

View File

@@ -104,7 +104,7 @@
*/
angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {
var LINKY_URL_REGEXP =
/((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>]/,
/((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"]/,
MAILTO_REGEXP = /^mailto:/;
return function(text, target) {

View File

@@ -25,6 +25,8 @@ describe('linky', function() {
toEqual('<a href="mailto:me@example.com">me@example.com</a>');
expect(linky("send email to me@example.com, but")).
toEqual('send email to <a href="mailto:me@example.com">me@example.com</a>, but');
expect(linky("my email is \"me@example.com\"")).
toEqual('my email is &#34;<a href="mailto:me@example.com">me@example.com</a>&#34;');
});
it('should handle target:', function() {