Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix($compile): whitelist file:// in url sanitization
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorMinar committed Feb 25, 2013
1 parent c36933d commit 7b236b2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ng/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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):/;


/**
Expand Down
4 changes: 4 additions & 0 deletions test/ng/compileSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2479,6 +2479,10 @@ describe('$compile', function() {
$rootScope.testUrl = "mailto:[email protected]";
$rootScope.$apply();
expect(element.attr('href')).toBe('mailto:[email protected]');

$rootScope.testUrl = "file:///foo/bar.html";
$rootScope.$apply();
expect(element.attr('href')).toBe('file:///foo/bar.html');
}));


Expand Down

0 comments on commit 7b236b2

Please sign in to comment.