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

Commit aaf9c5e

Browse files
committed
fix(minErr): encode btstrpd error input to strip angle brackets
The $sanitize service was returning an empty string to the error page because the input was usually a single html tag (sometimes it could be `document`). This fix replaces angle brackets with html entities. Closes #8683
1 parent 893d2f8 commit aaf9c5e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Angular.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1345,7 +1345,11 @@ function bootstrap(element, modules) {
13451345

13461346
if (element.injector()) {
13471347
var tag = (element[0] === document) ? 'document' : startingTag(element);
1348-
throw ngMinErr('btstrpd', "App Already Bootstrapped with this Element '{0}'", tag);
1348+
//Encode angle brackets to prevent input from being sanitized to empty string #8683
1349+
throw ngMinErr(
1350+
'btstrpd',
1351+
"App Already Bootstrapped with this Element '{0}'",
1352+
tag.replace(/</,'&lt;').replace(/>/,'&gt;'));
13491353
}
13501354

13511355
modules = modules || [];

test/AngularSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ describe('angular', function() {
822822
expect(function () {
823823
angular.bootstrap(element);
824824
}).toThrowMatching(
825-
/\[ng:btstrpd\] App Already Bootstrapped with this Element '<div class="?ng\-scope"?( ng[0-9]+="?[0-9]+"?)?>'/i
825+
/\[ng:btstrpd\] App Already Bootstrapped with this Element '&lt;div class="?ng\-scope"?( ng[0-9]+="?[0-9]+"?)?&gt;'/i
826826
);
827827

828828
dealoc(element);

0 commit comments

Comments
 (0)