diff --git a/src/ngSanitize/filter/linky.js b/src/ngSanitize/filter/linky.js index e0be704f9c2c..04c7d0402b55 100644 --- a/src/ngSanitize/filter/linky.js +++ b/src/ngSanitize/filter/linky.js @@ -104,8 +104,8 @@ */ angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) { var LINKY_URL_REGEXP = - /((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"”’]/, - MAILTO_REGEXP = /^mailto:/; + /((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"”’]/i, + MAILTO_REGEXP = /^mailto:/i; return function(text, target) { if (!text) return text; diff --git a/test/ngSanitize/filter/linkySpec.js b/test/ngSanitize/filter/linkySpec.js index baac45bd6d82..f0c4f3956e54 100644 --- a/test/ngSanitize/filter/linkySpec.js +++ b/test/ngSanitize/filter/linkySpec.js @@ -20,6 +20,15 @@ describe('linky', function() { expect(linky(undefined)).not.toBeDefined(); }); + it('should be case-insensitive', function() { + expect(linky('WWW.example.com')).toEqual('WWW.example.com'); + expect(linky('WWW.EXAMPLE.COM')).toEqual('WWW.EXAMPLE.COM'); + expect(linky('HTTP://www.example.com')).toEqual('HTTP://www.example.com'); + expect(linky('HTTP://example.com')).toEqual('HTTP://example.com'); + expect(linky('HTTPS://www.example.com')).toEqual('HTTPS://www.example.com'); + expect(linky('HTTPS://example.com')).toEqual('HTTPS://example.com'); + }); + it('should handle www.', function() { expect(linky('www.example.com')).toEqual('www.example.com'); });