fix($compile): whitelist file:// in url sanitization
This commit is contained in:
+1
-1
@@ -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):/;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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');
|
||||
}));
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user