mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-10 07:44:43 +00:00
fix($compile): whitelist file:// in url sanitization
This commit is contained in:
parent
6be24df5bc
commit
6c611df8f0
2 changed files with 5 additions and 1 deletions
|
|
@ -156,7 +156,7 @@ function $CompileProvider($provide) {
|
||||||
COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/,
|
COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/,
|
||||||
CLASS_DIRECTIVE_REGEXP = /(([\d\w\-_]+)(?:\:([^;]+))?;?)/,
|
CLASS_DIRECTIVE_REGEXP = /(([\d\w\-_]+)(?:\:([^;]+))?;?)/,
|
||||||
MULTI_ROOT_TEMPLATE_ERROR = 'Template must have exactly one root element. was: ',
|
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.testUrl = "mailto:foo@bar.com";
|
||||||
$rootScope.$apply();
|
$rootScope.$apply();
|
||||||
expect(element.attr('href')).toBe('mailto:foo@bar.com');
|
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');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue