fix($compile): whitelist file:// in url sanitization

This commit is contained in:
Igor Minar 2013-02-25 10:02:28 -08:00
parent 6be24df5bc
commit 6c611df8f0
2 changed files with 5 additions and 1 deletions

View file

@ -156,7 +156,7 @@ function $CompileProvider($provide) {
COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/,
CLASS_DIRECTIVE_REGEXP = /(([\d\w\-_]+)(?:\:([^;]+))?;?)/,
MULTI_ROOT_TEMPLATE_ERROR = 'Template must have exactly one root element. was: ',
urlSanitizationWhitelist = /^\s*(https?|ftp|mailto):/;
urlSanitizationWhitelist = /^\s*(https?|ftp|mailto|file):/;
/**

View file

@ -2484,6 +2484,10 @@ describe('$compile', function() {
$rootScope.testUrl = "mailto:foo@bar.com";
$rootScope.$apply();
expect(element.attr('href')).toBe('mailto:foo@bar.com');
$rootScope.testUrl = "file:///foo/bar.html";
$rootScope.$apply();
expect(element.attr('href')).toBe('file:///foo/bar.html');
}));