This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +8
-9
lines changed Expand file tree Collapse file tree 3 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -334,7 +334,6 @@ function $InterpolateProvider() {
334
334
335
335
return compute ( values ) ;
336
336
} catch ( err ) {
337
- console . log ( err . stack ) ;
338
337
$exceptionHandler ( $interpolateMinErr . interr ( text , err ) ) ;
339
338
}
340
339
Original file line number Diff line number Diff line change @@ -69,9 +69,9 @@ function $$SanitizeUriProvider() {
69
69
70
70
this . $get = function ( ) {
71
71
return function sanitizeUri ( uri , isMediaUrl ) {
72
+ if ( ! uri ) return uri ;
72
73
var regex = isMediaUrl ? imgSrcSanitizationWhitelist : aHrefSanitizationWhitelist ;
73
- var normalizedVal ;
74
- normalizedVal = urlResolve ( uri && uri . trim ( ) ) . href ;
74
+ var normalizedVal = urlResolve ( uri . trim ( ) ) . href ;
75
75
if ( normalizedVal !== '' && ! normalizedVal . match ( regex ) ) {
76
76
return 'unsafe:' + normalizedVal ;
77
77
}
Original file line number Diff line number Diff line change @@ -11173,13 +11173,13 @@ describe('$compile', function() {
11173
11173
$rootScope . $digest ( ) ;
11174
11174
expect ( element . attr ( 'src' ) ) . toEqual ( 'unsafe:untrusted:foo();ponies' ) ;
11175
11175
11176
- element = $compile ( '<img src="http://{{testUrl }}"></img>' ) ( $rootScope ) ;
11177
- $rootScope . testUrl = $sce . trustAsUrl ( 'untrusted:foo() ;' ) ;
11176
+ element = $compile ( '<img src="http://{{testUrl2 }}"></img>' ) ( $rootScope ) ;
11177
+ $rootScope . testUrl2 = $sce . trustAsUrl ( 'xyz ;' ) ;
11178
11178
$rootScope . $digest ( ) ;
11179
- expect ( element . attr ( 'src' ) ) . toEqual ( 'http://untrusted:foo() ;' ) ;
11179
+ expect ( element . attr ( 'src' ) ) . toEqual ( 'http://xyz ;' ) ;
11180
11180
11181
- element = $compile ( '<img src="{{testUrl }}{{testUrl }}"></img>' ) ( $rootScope ) ;
11182
- $rootScope . testUrl = $sce . trustAsUrl ( 'untrusted:foo();' ) ;
11181
+ element = $compile ( '<img src="{{testUrl3 }}{{testUrl3 }}"></img>' ) ( $rootScope ) ;
11182
+ $rootScope . testUrl3 = $sce . trustAsUrl ( 'untrusted:foo();' ) ;
11183
11183
$rootScope . $digest ( ) ;
11184
11184
expect ( element . attr ( 'src' ) ) . toEqual ( 'unsafe:untrusted:foo();untrusted:foo();' ) ;
11185
11185
} ) ) ;
@@ -11220,7 +11220,7 @@ describe('$compile', function() {
11220
11220
expect ( element . attr ( 'src' ) ) . toEqual ( 'someSanitizedUrl' ) ;
11221
11221
11222
11222
element = $compile ( '<img src="http://{{testUrl}}"></img>' ) ( $rootScope ) ;
11223
- $rootScope . testUrl = $sce . trustAsUrl ( 'javascript:foo(); ' ) ;
11223
+ $rootScope . testUrl = $sce . trustAsUrl ( 'xyz ' ) ;
11224
11224
$rootScope . $digest ( ) ;
11225
11225
expect ( element . attr ( 'src' ) ) . toEqual ( 'someSanitizedUrl' ) ;
11226
11226
} ) ;
You can’t perform that action at this time.
0 commit comments