File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -305,7 +305,11 @@ function intrinsicOrExtrinsicSizing( computedStyles ) {
305305function getImgData ( img ) {
306306
307307 const imgData = imgFeatures ( img ) ;
308- imgData . url = img . currentSrc || img . src ;
308+ // Limit data URLs so they don't take up huge amounts of space.
309+ imgData . url =
310+ ( img . currentSrc || img . src ) ?. startsWith ( 'data:' ) && ( img . currentSrc || img . src ) ?. length > 50 ?
311+ ( img . currentSrc || img . src ) ?. slice ( 0 , 50 ) + '…' :
312+ ( img . currentSrc || img . src ) ;
309313 imgData . totalCandidates = totalNumberOfCandidates ( img ) ;
310314
311315 if ( imgData . hasHeight ) {
@@ -358,7 +362,10 @@ function getImgData( img ) {
358362 ! isFromSource &&
359363 ! ( imgData . srcsetHasWDescriptors ) ) {
360364 srcsetCandidates . push ( {
361- url : img . getAttribute ( 'src' )
365+ // Limit data URLs so they don't take up huge amounts of space.
366+ url : img . getAttribute ( 'src' ) ?. startsWith ( 'data:' ) && img . getAttribute ( 'src' ) ?. length > 50 ?
367+ img . getAttribute ( 'src' ) ?. slice ( 0 , 50 ) + '…' :
368+ img . getAttribute ( 'src' )
362369 } )
363370 }
364371
You can’t perform that action at this time.
0 commit comments