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

Commit 0872388

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 3623019 commit 0872388

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
@@ -1398,7 +1398,11 @@ function bootstrap(element, modules, config) {
13981398

13991399
if (element.injector()) {
14001400
var tag = (element[0] === document) ? 'document' : startingTag(element);
1401-
throw ngMinErr('btstrpd', "App Already Bootstrapped with this Element '{0}'", tag);
1401+
//Encode angle brackets to prevent input from being sanitized to empty string #8683
1402+
throw ngMinErr(
1403+
'btstrpd',
1404+
"App Already Bootstrapped with this Element '{0}'",
1405+
tag.replace(/</,'&lt;').replace(/>/,'&gt;'));
14021406
}
14031407

14041408
modules = modules || [];

test/AngularSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ describe('angular', function() {
796796
expect(function () {
797797
angular.bootstrap(element);
798798
}).toThrowMatching(
799-
/\[ng:btstrpd\] App Already Bootstrapped with this Element '<div class="?ng\-scope"?( ng[0-9]+="?[0-9]+"?)?>'/i
799+
/\[ng:btstrpd\] App Already Bootstrapped with this Element '&lt;div class="?ng\-scope"?( ng[0-9]+="?[0-9]+"?)?&gt;'/i
800800
);
801801

802802
dealoc(element);

0 commit comments

Comments
 (0)